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)

더 많은