멀티 타임프레임 오스실레이션 채널 트렌드 추적 전략

저자:차오장, 날짜: 2023-12-25 14:27:06
태그:

전반적인 설명

이 전략은 슈퍼트렌드 지표와 여러 시간 프레임 시장 트렌드 분석을 결합하여 오스실레이션 채널 방법을 채택하여 진입 기회를 식별합니다.

전략 원칙

  • 트렌드 방향을 결정하기 위해 전통적인 슈퍼 트렌드 지표를 사용
  • 더 높은 시간 프레임의 슈퍼 트렌드를 추가하여 더 높은 시간 프레임에도 트렌드가 있는지 확인합니다.
  • 두 시간 프레임의 슈퍼트렌드 지표에 기초하여 전체 트렌드 방향을 결정합니다.
  • 오스실레이션 채널의 상부 및 하부 레일의 가격 파업에 기초한 특정 진입 기회를 식별

이점 분석

  • 다중 시간 프레임 분석은 추세 판단을 더 신뢰할 수 있습니다.
  • 높은 기간과 낮은 기간을 결합하면 주요 추세를 파악하고 단기적 기회를 포착 할 수 있습니다.
  • 오스실레이션 채널 설정은 위험 통제를 돕는 손실 포인트를 중지

위험 과 해결책

  • 슈퍼트렌드 자체는 트렌드 반전 지점을 놓칠 수 있는 어떤 후퇴 현상을 가지고 있습니다.
  • 지연 위험은 매개 변수를 최적화하거나 트렌드 변화를 식별하는 데 도움이되는 다른 지표를 통합하여 줄일 수 있습니다.

최적화 방향

  • 지연을 줄이기 위해 슈퍼트렌드 매개 변수를 최적화
  • 주요 트렌드를 더 정확하게 파악하기 위해 트렌드 필터링 지표를 추가합니다.
  • 더 적절한 스톱 로스 방법을 테스트하고 선택합니다.

요약

이 전략은 여러 시간 프레임 분석과 트렌드 추적 지표를 통합하여 주요 트렌드를 파악하고 특정 진입 기회를 찾습니다. 지속적인 최적화로 장기적으로 안정적인 초과 수익을 얻을 것으로 예상됩니다.


/*backtest
start: 2022-12-18 00:00:00
end: 2023-12-24 00:00:00
period: 1d
basePeriod: 1h
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/
// © ramki_simple
// Thanks to LonesomeTheBlue for the original code
//@version=4
strategy("Multi Supertrend with no-repaint HTF option strategy", overlay = true, shorttitle='Multi Supertrend')
//auto higher time frame
HTFAuto = timeframe.period == '1' ? '5' : 
  timeframe.period == '3' ? '15' : 
  timeframe.period == '5' ? '15' : 
  timeframe.period == '15' ? '60' : 
  timeframe.period == '30' ? '60' : 
  timeframe.period == '45' ? '60' : 
  timeframe.period == '60' ? '240' : 
  timeframe.period == '120' ? '240' : 
  timeframe.period == '180' ? '240' : 
  timeframe.period == '240' ? 'D' : 
  timeframe.period == 'D' ? 'W' :
  '5W'
HTFSelection = input(title='Select HTF Automatically for Additional Supertrend', type=input.bool, defval=false)
HTFUserSel = input(title='Select Higher Timeframe for Additional Supertrend',type=input.resolution, defval ='')
HTF = HTFSelection ? HTFAuto : HTFUserSel


Mult1 = input(title='Multiplier for Default Supertrend', defval=3.0, minval = 0, maxval = 10)
Period1 = input(title='Period for Default Supertrend', defval=10, minval = 1, maxval = 100)
Mult2 = input(title='Multiplier for Additional Supertrend', defval=2.0, minval = 0, maxval = 10)
Period2 = input(title='Period for Additional Supertrend', defval=14, minval = 1, maxval = 100)

chbarcol = input(true, title = "Change Bar Color")

[Trailings, Trend] = supertrend(Mult1, Period1)

linecolor = Trend == -1 and Trend[1] == -1 ? color.teal :
   Trend == 1 and Trend[1] == 1 ? color.red :
   color.new(color.white, 100)
plot(Trailings, color = linecolor,  linewidth = 2,title = "SuperTrend")

f_Security(_symbol, _res, _src) => security(_symbol, _res, _src[1], lookahead = barmerge.lookahead_on)

nonVectorSupertrend(Mult, Period) =>
    [Trail_, Trend_] = supertrend(Mult, Period)
    Trail_*Trend_


[TrailingslHtf, TrendHtf] = supertrend(Mult2, Period2)

if HTF != timeframe.period and HTF != ''
    CompositeTrailHtf = f_Security(syminfo.tickerid, HTF,nonVectorSupertrend(Mult2, Period2) )
    TrailingslHtf := abs(CompositeTrailHtf)
    TrendHtf := CompositeTrailHtf > 0 ? 1 : -1


linecolorHtf = TrendHtf == -1 and TrendHtf[1] == -1 ? color.blue :
   TrendHtf == 1 and TrendHtf[1] == 1 ? color.maroon :
   color.new(color.white, 100)
plot(TrailingslHtf, color = linecolorHtf, linewidth = 3, title = "Supertrend Higher Time Frame")

barcolor_ = Trend == -1 and TrendHtf == -1 ? color.lime :
   Trend == 1 and TrendHtf == 1 ? color.red :
   color.white
barcolor(color = chbarcol ? barcolor_ : na)

vwapfilter = input(false)

Long = Trend == -1 and TrendHtf == -1
Short = Trend == 1 and TrendHtf == 1
strategy.entry("enter long", true, 1, when = Long and not Long[1] and (vwapfilter and close > vwap or not vwapfilter))
strategy.entry("enter short", false, 1, when = Short and not Short[1] and (vwapfilter and close < vwap or not vwapfilter))
strategy.close("enter long", when = Long[1] and not Long)
strategy.close("enter short", when = Short[1] and not Short)

더 많은