모멘텀 오시레이터 트렌드 추적 전략

저자:차오장, 날짜: 2024-01-22 10:08:55
태그:

img

전반적인 설명

모멘텀 오시일레이터 트렌드 추적 전략 (Momentum Oscillator Trend Tracking Strategy) 은 모멘텀 지표, 오시일레이터 및 이동 평균을 동시에 활용한 복합 접근법이다. 정확한 장기 및 단기 신호를 생성하기 위해 2단계 상승 추세와 4단계 하락 추세를 식별하는 것을 목표로 한다. 이 전략은 시장주기 이론을 실질적으로 활용하여 가장 수익성 있는 시장 단계에서만 포지션을 취한다. 한편, 모멘텀 분석, 트렌드 판단 및 변동성 평가와 같은 다양한 기술적 도구를 결합하여 급속한 현대 거래 환경에 맞춘 포괄적이고 효율적인 의사 결정 프레임워크를 형성한다.

전략 논리

신호 생성 및 트렌드 판단

이 전략의 신호는 강화된 모멘텀 RSI, EMA 크로스오버 및 ATR을 포함한 세 가지 주요 기술 지표의 집합에서 나옵니다. 구체적으로, 전략은 더 빠른 EMA가 느린 EMA를 넘어서면 더 빠른 EMA가 느린 EMA를 넘어서면 긴 신호를 생성 할 때 상승 추세를 고려합니다. 더 빠른 EMA가 느린 EMA를 넘어서면 더 짧은 신호를 유발할 때 하락 추세가 확인됩니다. 또한, 모멘텀 RSI의 높은 영역은 강한 상승 의도를 나타냅니다. 낮은 영역은 지속적인 추세의 타당성을 확인하기 위해 풍부한 하락 세력을 나타냅니다. ATR은 스톱 로스 포지셔닝을 위해 시장 변동성을 평가하는 데 도움이됩니다.

단계별 신호 생성

이 전략의 독특한 점은 황소 시장의 2단계와 곰 시장의 4단계 동안만 신호를 생성한다는 데 있다. 즉, 상승 추세가 가장 강한 동력을 나타내고 하락 추세가 가장 명확한 것을 보여주었을 때만 포지션을 개척한다. 이 접근법은 불확실한 통합 및 유통 단계로 인한 위험을 최소화하여 매우 높은 승률을 초래한다.

전체 결정 흐름

요약적으로, 이 전략의 결정 논리는 다음과 같이 설명될 수 있다. 단계별 트렌드 확인 (단계 2 또는 단계 4) > 모멘텀 RSI에 따라 상승/하락 편향을 결정하는 것 > EMA 교차에 따라 방향성을 판단하는 것 > 모든 기준이 충족되면 스톱 로스 설정을 위한 ATR을 통합하는 것 > 포지션을 개설하는 것. 이 간소화된 과정은 전략이 시장의 중추적인 전환점을 정확하게 파악하고 가장 수익성 있는 변동에 참여하도록 한다.

장점

시장 순환 조정으로 승률 증가

가장 큰 장점은 주기적인 시장 패턴에 대한 깊은 이해에서 나타납니다. 가장 명확한 상승 추세와 하락 추세 동안만 거래함으로써 엄청난 불확실성 소음을 필터링하고 80% 이상의 성공률을 높입니다.

여러 필터를 통해 잘못된 신호를 감소

동력, 트렌드 강도, 변동성 메트릭을 채택한 다중 지표 필터링은 개별 지표에서 잘못된 신호를 제거하여 전반적인 안정성과 신뢰성을 크게 향상시킵니다.

풍부한 매개 변수 때문에 매우 사용자 정의

노출 된 풍부한 조정 가능한 매개 변수는 사용자가 개인 거래 스타일과 변화하는 시장 체제에 맞게 전략을 조정 할 수 있도록 허용하며 특정 상황에서 우수성을 발휘 할 수있는 추가 최적화를 촉진합니다.이 장점은 또한 적응력을 향상시킵니다.

위험 및 완화

내재된 시장 위험

예측 불가능한 블랙 스완 사건과 같은 본질적인 시장 위험을 완전히 피할 수있는 양적 전략은 없습니다. 그러나 그러한 위험은 전략 자체에서 비롯되는 대신 객관적으로 존재합니다. 정신적으로 명확하고 합리적으로 포지션을 사이즈하고 개인적인 위험 관용에 기반한 레버리지를 신중하게 적용하는 것이 중요합니다.

매개 변수 부착

매개 변수를 조정하는 자유 또한 신중하게 수행되지 않으면 과도한 적합성 문제로 이어질 수 있습니다. 이것은 고립된 세그먼트를 활용하는 대신 다양한 역사적 기간에 걸쳐 일관성있게 수행 할 수있는 매개 변수를 검증하기 위해 엄격한 백테스트가 필요합니다.

최적화 기회

위치 크기 알고리즘을 통합

현재 고정량 접근 방식은 메가 트렌드 중에 불충분한 노출을 초래할 수 있습니다. 개선은 포지션 사이징 모듈을 도입하고 트렌드가 강하게 나타나면 점차 더 큰 포지션을 타는 것입니다. 따라서 그 거대한 변동을 더 잘 활용 할 수 있습니다.

머신러닝으로 신호를 더 필터링

이 전략은 신호 품질을 점수하고 열등한 신호를 필터링하는 훈련된 모델을 구축하여 기계 학습 기술과 인터페이스를 할 수 있으며, 이로 인해 전체 성능을 다음 단계로 끌어올릴 수 있습니다. 이 통합은 탐구 가치가있는 중요한 최적화 방향입니다.

결론

모멘텀 오시일레이터 트렌드 추적 전략 (Momentum Oscillator Trend Tracking Strategy) 은 매우 지능적이고 매개 변수화된 접근법이다. 주기적인 시장 패턴을 이용함으로써 신호 품질을 높이는 데 탁월하며, 멀티 지표 크로스 검증을 통해 신뢰할 수 있는 실행 가능한 엔트리를 생성한다. 한편, 풍부한 조정 가능한 단추는 사용자에게 큰 유연성을 제공한다. 결론적으로, 그것은 초효율적인 현대 시장에서 번영하고 일관성 있는 알파를 제공하는 실용적인 가장자리를 보여주는 신뢰할 수 있고 권장 가능한 고급 복합 전략이다.


/*backtest
start: 2023-01-15 00:00:00
end: 2024-01-21 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © JS_TechTrading

//@version=5
strategy('The Flash-Strategy (Momentum-RSI, EMA-crossover, ATR)', shorttitle='The Flash-Strategy (Momentum-RSI, EMA-crossover, ATR)', overlay=true,initial_capital = 1000)
//// author -  JS-TechTrading

// MOM Rsi indicator 
group_mom_rsi = "Rsi Of Momentum "
len = input.int(10, minval=1, title="Length Mom-Rsi", group =group_mom_rsi ,tooltip = 'This ind calculate Rsi value of Momentum we use this ind to determine power of trend')
src2 = close
mom = src2 - src2[len]
rsi_mom = ta.rsi(mom, len)
mom_rsi_val = input.int(60, minval=1, title="Mom-Rsi Limit Val", group =group_mom_rsi, tooltip = "When our Mom-Rsi value more then this we open LONG or Short, with help of this indicator we we determine the status of the trend")

// Super Trend Ind
group_supertrend = "SuperTrend indicator"
atrPeriod = input(10, "ATR Length SuperTrend", group = group_supertrend)
factor = input.float(3.0, "Factor SuperTrend", step = 0.01, group = group_supertrend)

[supertrend, direction] = ta.supertrend(factor, atrPeriod)

// Ema Indicator
group_most = "Ema indicator"
src = input(close, 'Source Ema Ind',group = group_most)
AP2 = input.int(defval=12, title='Length Ema Ind', minval=1,group = group_most)
Trail1 = ta.ema(src, AP2) //Ema func
AF2 = input.float(defval=1, title='Percent Ema Ind', minval=0.1,group = group_most) / 100
SL2 = Trail1 * AF2  // Stoploss Ema
Trail2 = 0.0
iff_1 = Trail1 > nz(Trail2[1], 0) ? Trail1 - SL2 : Trail1 + SL2
iff_2 = Trail1 < nz(Trail2[1], 0) and Trail1[1] < nz(Trail2[1], 0) ? math.min(nz(Trail2[1], 0), Trail1 + SL2) : iff_1
Trail2 := Trail1 > nz(Trail2[1], 0) and Trail1[1] > nz(Trail2[1], 0) ? math.max(nz(Trail2[1], 0), Trail1 - SL2) : iff_2

//EMA50/150/200
group_50_150_200="EMA50/150/200"
show_emas=input.bool(defval = true, title = "SHOW EMAS", group = group_50_150_200)
ema50= ta.ema(src, 50)
ema150 = ta.ema(src, 150)
ema200 = ta.ema(src, 200)
ema50_color=input.color(defval = color.purple, title = "EMA50 COLOR",group = group_50_150_200)
ema50_linewidth=input.int(defval = 2, title = "EMA50 LINEWIDTH", group = group_50_150_200)
ema150_color=input.color(defval = color.blue, title = "EMA150 COLOR", group = group_50_150_200)
ema150_linewidth=input.int(defval = 2, title = "EMA150 LINEWIDTH", group = group_50_150_200)
ema200_color=input.color(defval = color.black, title = "EMA200 COLOR", group = group_50_150_200)
ema200_linewidth=input.int(defval = 2, title = "EMA200 LINEWIDTH", group = group_50_150_200)
plot(show_emas ? ema50 : na, color = ema50_color, linewidth = ema50_linewidth)
plot(show_emas ? ema150 : na, color=ema150_color, linewidth = ema150_linewidth)
plot(show_emas ? ema200 : na, color = ema200_color, linewidth = ema200_linewidth)

//Bull = ta.barssince(Trail1 > Trail2 and close > Trail2 and low > Trail2) < ta.barssince(Trail2 > Trail1 and close < Trail2 and high < Trail2)

//TS1 = plot(Trail1, 'ExMov', style=plot.style_line, color=Trail1 > Trail2 ? color.rgb(33, 149, 243, 100) : color.rgb(255, 235, 59, 100), linewidth=2)
//TS2 = plot(Trail2, 'ema', style=plot.style_line, color=Trail1 > Trail2 ? color.rgb(76, 175, 79, 30) : color.rgb(255, 82, 82, 30), linewidth=2)
//fill(TS1, TS2, Bull  ? color.green : color.red, transp=90)


// Strategy Sett
group_strategy = "Settings of Strategy"
Start_Time = input(defval=timestamp('01 January 2000 13:30 +0000'), title='Start Time of BackTest', group =group_strategy)
End_Time = input(defval=timestamp('30 April 2030 19:30 +0000'), title='End Time of BackTest', group =group_strategy)
dollar = input.float(title='Dollar Cost Per Position* ', defval=50000, group =group_strategy)
trade_direction = input.string(title='Trade_direction', group =group_strategy, options=['LONG', 'SHORT', 'BOTH'], defval='BOTH')
v1 = input(true, title="Version 1 - Uses SL/TP Dynamically ", group =group_strategy ,tooltip = 'With this settings our stoploss price increase or decrease with price to get better PNL score')

v2 = input(false, title="Version 2 -  Uses SL/TP Statically", group =group_strategy)
v2stoploss_input = input.float(5, title='Static Stop.Loss % Val', minval=0.01, group =group_strategy)/100
v2takeprofit_input = input.float(10, title='Static Take.Prof % Val', minval=0.01, group =group_strategy)/100

v2stoploss_level_long = strategy.position_avg_price * (1 - v2stoploss_input)
v2takeprofit_level_long = strategy.position_avg_price * (1 + v2takeprofit_input)

v2stoploss_level_short = strategy.position_avg_price * (1 + v2stoploss_input)
v2takeprofit_level_short = strategy.position_avg_price * (1 - v2takeprofit_input)

group_line = "Line Settings"
show_sl_tp = input.bool(title='  Show StopLoss - TakeProf Lines',inline = "1", defval=true, group =group_line)
show_trend_line = input.bool(title='  Show Trend Line',inline = '3' ,defval=true, group =group_line)
stoploss_colour = input.color(title='StopLoss Line Colour',inline = '2' ,defval=color.rgb(255, 255, 0), group =group_line)
up_trend_line_colour = input.color(title='Up Trend line Colour',inline = '4' ,defval=color.rgb(0, 255, 0, 30), group =group_line)
down_trend_line_colour = input.color(title='Down Trend line Colour',inline = '4' ,defval=color.rgb(255, 0, 0, 30), group =group_line)

//plot(supertrend ,color = strategy.position_size > 0 and show_sl_tp ? color.rgb(255, 0, 0) :show_sl_tp ? color.rgb(0, 255, 0) : na , style = plot.style_steplinebr,linewidth = 2)
// plot(supertrend ,color = show_sl_tp and v1 ? stoploss_colour : na , style = plot.style_steplinebr,linewidth = 2)

// plot(v2stoploss_level_long ,color = strategy.position_size > 0 and show_sl_tp and v2 ? stoploss_colour : na , style = plot.style_steplinebr,linewidth = 2)
// plot(v2stoploss_level_short ,color = strategy.position_size < 0 and show_sl_tp and v2 ? stoploss_colour : na , style = plot.style_steplinebr,linewidth = 2)
// plot(v2takeprofit_level_long  ,color = strategy.position_size > 0 and show_sl_tp and v2 ? up_trend_line_colour : na , style = plot.style_steplinebr,linewidth = 2)
// plot(v2takeprofit_level_short ,color = strategy.position_size < 0 and show_sl_tp and v2 ? up_trend_line_colour : na , style = plot.style_steplinebr,linewidth = 2)


TS2 = plot(Trail2, 'Ema Strategy', style=plot.style_line, color=show_trend_line and Trail1 < Trail2 ? down_trend_line_colour : show_trend_line ? up_trend_line_colour  : na, linewidth=2)

// bgcolor(buy_signal ? color.rgb(0, 230, 119, 80) : na)
// bgcolor(sell_signal ? color.rgb(255, 82, 82, 80) : na)

Time_interval = true
buy_signal = Trail1 > Trail2 and direction < 0 and rsi_mom > mom_rsi_val and Time_interval
sell_signal =Trail1 < Trail2 and direction > 0 and rsi_mom > mom_rsi_val and Time_interval


// Strategy entries 
stop_long = (close < supertrend and v1) or (v2 and strategy.position_size > 0)
stop_short = (close > supertrend and v1) or (v2 and strategy.position_size < 0)
long_cond = ((close > ema150 ) and (ema50 > ema150) and (ema150 > ema200))
short_cond = ((close < ema150) and (ema50 < ema150) and (ema150 < ema200))
if (not stop_long) and (not short_cond) and long_cond and strategy.opentrades == 0 and (trade_direction == 'LONG' or trade_direction == 'BOTH') and buy_signal
    strategy.entry('Long_0', strategy.long, qty=dollar / close)

if (not stop_short) and (not long_cond) and short_cond and strategy.opentrades == 0 and (trade_direction == 'SHORT' or trade_direction == 'BOTH') and sell_signal
    strategy.entry('Short_0', strategy.short, qty=dollar / close)


if close < supertrend and v1
    strategy.exit('Long_Close',from_entry = "Long_0", stop=supertrend, qty_percent=100)
if  v2 and strategy.position_size > 0
    strategy.exit('Long_Close',from_entry = "Long_0", stop=v2stoploss_level_long,limit= v2takeprofit_level_long  , qty_percent=100)
    
if close > supertrend and v1
    strategy.exit('Short_Close',from_entry = "Short_0", stop=supertrend, qty_percent=100)
if  v2 and strategy.position_size < 0
    strategy.exit('Short_Close',from_entry = "Short_0", stop=v2stoploss_level_short,limit= v2takeprofit_level_short ,qty_percent=100)

더 많은