複数のタイムフレームの振動チャネルトレンド追跡戦略

作者: リン・ハーンチャオチャン開催日:2023年12月25日 14:27:06
タグ:

概要

この戦略は,スーパートレンド指標と複数のタイムフレームの市場動向分析を組み合わせ,エントリー機会を特定するために振動チャネル方法を採用しています.

戦略原則

  • トレンド方向を決定するために従来のスーパートレンド指標を使用します.
  • 超トレンドを追加します.
  • 2つのタイムフレームのスーパートレンド指標に基づいて,全体的なトレンド方向を決定する
  • 振動チャネルの上部と下部レールの価格ブレイクに基づいて,特定のエントリー機会を特定する.

利点分析

  • 複数の時間枠分析により,傾向判断がより信頼性がある
  • 高値と低値の時間枠を組み合わせることで,短期的な機会を把握しながら,主要な傾向を把握できます
  • 振動チャネル設定は,リスク制御を助ける損失ポイントを停止します

リスク と 解決策

  • スーパートレンド自体には,トレンド逆転点を逃すかもしれない,いくつかの遅れの現象があります.
  • パラメータを最適化したり,傾向の変化を特定するのに役立つ他の指標を組み込むことで遅れのリスクは軽減できます

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

  • 遅延を減らすためにSupertrendパラメータを最適化
  • 主要なトレンドをより正確に把握するためにトレンドフィルタリング指標を追加します
  • より適切なストップ・ロスト・メソッドをテストし選択する

概要

この戦略は,複数のタイムフレーム分析とトレンド追跡指標を統合し,主要なトレンドを把握し,特定のエントリー機会を探しています.継続的な最適化により,長期的に安定した過剰収益を達成することが期待されています.


/*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)

もっと