모멘텀 트렌드 동기 전략


생성 날짜: 2024-01-16 14:10:25 마지막으로 수정됨: 2024-01-16 14:10:25
복사: 0 클릭수: 818
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

모멘텀 트렌드 동기 전략

개요

동력 트렌드 동기화 전략은 상대 동력 지수 ((RMI) 와 슈퍼 트렌드 지표의 장점을 통합하여 동력 분석과 트렌드 판단의 효과적인 결합을 실현합니다. 이 전략은 가격 변화의 경향과 시장 동력 수준에 동시에 관심을 기울여 시장의 방향을 더 포괄적인 관점에서 판단합니다.

전략 원칙

상대 운동량 지수 (RMI)

RMI는 상대적 강도 지수 (RSI) 의 개선된 버전이다. 가격 변화의 방향성, 크기 등과 같은 더 많은 특성을 통합하여 시장 동력을 더 정확하게 판단할 수 있다.

RMI 계산 방법

RMI의 계산 방법은 다음과 같다: 먼저 일정 기간 동안의 평균 상승과 평균 하락을 계산한다. RSI와 달리 RMI는 단순한 긍정적 성장과 부정적인 성장이 아닌 당일 종료 가격의 변화 값을 사용합니다.

동력 판단

이 전략은 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)