RMI トレンドシンクロ戦略

作者: リン・ハーンチャオチャン,日付: 2024-01-16 14:10:25
タグ:

img

概要

RMIトレンドシンク戦略は,相対動量指数 (RMI) とスーパートレンド指標の強みを効果的に組み合わせ,動量分析とトレンド判断の統合を実現する.価格変動傾向と市場動量レベルを同時にモニタリングすることにより,戦略はより包括的な観点から市場動向を決定する.

戦略の原則

相対勢力の指数 (RMI)

RMIは,相対強度指数 (RSI) の強化版である.市場勢力をより正確に測定するために,方向性や大きさなどの価格変動のより多くの特徴を組み込む.

RMI 計算方法

RMIの計算方法は:まず,特定の期間における平均利益と平均損失を計算する.RSIとは異なり,RMIは,単純な正と負の成長ではなく,現在の閉店価格と以前の閉店価格の間の変化を使用する.その後,平均利益を平均損失で分割し,値を0-100スケールに適合するように正規化する.

モメント判断

この戦略は,RMIとMFIの平均値を,前もって設定された正動量と負動量値と比較して,入国および退出決定の現在の市場動量的レベルを決定します.

超傾向指標

スーパートレンド指標は,より高い時間枠に基づいて計算され,主要なトレンドについての判断を提供することができます.それは,トレンド逆転を効果的に特定するために,真の波動性ATRに基づいてパラメータを動的に調整します.
この戦略には,重要トレンドシフトを検出する能力をさらに強化するために,ボリューム重量移動平均 (VWMA) も含まれています.

取引方向の選択

この戦略により,長期・短期・双方向取引を選択できます.この柔軟性により,トレーダーは市場観やリスクへの意欲に合わせて取引することができます.

利点分析

モメントとトレンド分析を組み合わせる

この戦略は,RMIとスーパートレンドの強みを統合することで,モメンタムまたはトレンド指標だけに依存する戦略と比較して,より正確な市場トレンドの識別を実現します.

多期分析

RMIとスーパートレンドを異なる時間枠に適用すると,短期的および長期的トレンドの両方をより適切に把握できます.

リアルタイムストップ・ロスト

超トレンドに基づくリアルタイムストップ損失メカニズムは,取引毎の損失を効果的に制限することができます.

柔軟な取引方向性

長期・短期・双方向取引の選択により この戦略は 異なる市場環境に適応できます

リスク分析

難しいパラメータ最適化

RMIやスーパートレンドのようなパラメータの最適化はかなり複雑です.不適切な設定は戦略のパフォーマンスを損なう可能性があります.

ストップ 損失 太りすぎる

小幅な変動に過度に敏感であることにより,過剰なストップロスのトリガーが発生する可能性があります.

解決法:ストップ・ロスの範囲を適正に緩和するか,他の変動に基づくストップ・ロスの方法を採用する.

オプティマイゼーションの方向性

クロス アセット アダプタビリティ

適用可能な資産を拡大し,異なる資産のパラメータ最適化方向性を特定し,より多くの市場でより広範な複製を可能にします.

ダイナミックストップ損失

ダイナミックストップ・ロスのメカニズムを組み込み,現在のスイング・ウェーブをより正確に追跡し,軽微なリトレースによる過剰なストップ・ロスを減らす.

追加のフィルター条件

より多くの指標からの判断をフィルター条件として追加し,明確な信号なしのポジションに入らないようにします.

結論

RMIとスーパートレンドの巧妙な組み合わせにより,この戦略は正確な市場状況判断を実現する.また,リスク管理でも優れている.深層の最適化により,より多くの資産とタイムフレームでのパフォーマンスはますます顕著になると考えられている.


/*backtest
start: 2023-12-01 00:00:00
end: 2023-12-31 23:59:59
period: 3h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// @ presentTrading

//@version=5
strategy("RMI Trend Sync - Strategy [presentTrading]", shorttitle = "RMI Sync [presentTrading]", overlay=true )

// ---> Inputs --------------
// Add Button for Trading Direction
tradeDirection = input.string("Both", "Select Trading Direction", options=["Long", "Short", "Both"])

// Relative Momentum Index (RMI) Settings
Length = input.int(21, "RMI Length", group = "RMI Settings")
pmom = input.int(70, "Positive Momentum Threshold", group = "RMI Settings")
nmom = input.int(30, "Negative Momentum Threshold", group = "RMI Settings")
bandLength = input.int(30, "Band Length", group = "Momentum Settings")
rwmaLength = input.int(20, "RWMA Length", group = "Momentum Settings")


// Super Trend Settings
len = input.int(10, "Super Trend Length", minval=1, group="Super Trend Settings")
higherTf1 = input.timeframe('480', "Higher Time Frame", group="Super Trend Settings")
factor = input.float(3.5, "Super Trend Factor", step=.1, group="Super Trend Settings")
maSrc = input.string("WMA", "MA Source", options=["SMA", "EMA", "WMA", "RMA", "VWMA"], group="Super Trend Settings")
atr = request.security(syminfo.tickerid, higherTf1, ta.atr(len))
TfClose1 = request.security(syminfo.tickerid, higherTf1, close)

// Visual Settings
filleshow = input.bool(true, "Display Range MA", group = "Visual Settings")
bull = input.color(#00bcd4, "Bullish Color", group = "Visual Settings")
bear = input.color(#ff5252, "Bearish Color", group = "Visual Settings")

// Calculation of Bar Range
barRange = high - low

// RMI and MFI Calculations
upChange = ta.rma(math.max(ta.change(close), 0), Length)
downChange = ta.rma(-math.min(ta.change(close), 0), Length)
rsi = downChange == 0 ? 100 : upChange == 0 ? 0 : 100 - (100 / (1 + upChange / downChange))
mf = ta.mfi(hlc3, Length)
rsiMfi = math.avg(rsi, mf)

// Momentum Conditions
positiveMomentum = rsiMfi[1] < pmom and rsiMfi > pmom and rsiMfi > nmom and ta.change(ta.ema(close,5)) > 0
negativeMomentum = rsiMfi < nmom and ta.change(ta.ema(close,5)) < 0

// Momentum Status
bool positive = positiveMomentum ? true : negativeMomentum ? false : na
bool negative = negativeMomentum ? true : positiveMomentum ? false : na

// Band Calculation
calculateBand(len) =>
    math.min(ta.atr(len) * 0.3, close * (0.3/100)) * 4 

band = calculateBand(bandLength)

// Range Weighted Moving Average (RWMA) Calculation
calculateRwma(range_, period) =>
    weight = range_ / math.sum(range_, period)
    sumWeightedClose = math.sum(close * weight, period)
    totalWeight = math.sum(weight, period)
    sumWeightedClose / totalWeight

rwma = calculateRwma(barRange, rwmaLength)
colour = positive ? bull : negative ? bear : na
rwmaAdjusted = positive ? rwma - band : negative ? rwma + band : na

max = rwma + band
min = rwma - band

longCondition       = positive and not positive[1]
shortCondition      = negative and not negative[1]

longExitCondition   = shortCondition
shortExitCondition  = longCondition

// Dynamic Trailing Stop Loss

vwma1 = switch maSrc
    "SMA"  => ta.sma(TfClose1*volume, len) / ta.sma(volume, len)
    "EMA"  => ta.ema(TfClose1*volume, len) / ta.ema(volume, len)
    "WMA"  => ta.wma(TfClose1*volume, len) / ta.wma(volume, len)

upperBand = vwma1 + factor * atr
lowerBand = vwma1 - factor * atr
prevLowerBand = nz(lowerBand[1])
prevUpperBand = nz(upperBand[1])
float superTrend = na
int direction = na
superTrend := direction == -1 ? lowerBand : upperBand

longTrailingStop = superTrend - atr * factor
shortTrailingStop = superTrend + atr * factor

// Strategy Order Execution
if (tradeDirection == "Long" or tradeDirection == "Both")
    strategy.entry("Long", strategy.long, when = longCondition)
    strategy.exit("Exit Long", "Long", when=longExitCondition, stop = longTrailingStop)
if (tradeDirection == "Short" or tradeDirection == "Both")
    strategy.entry("Short", strategy.short, when =shortCondition)
    strategy.exit("Exit Short", "Short", when=shortExitCondition, stop = shortTrailingStop)

もっと