マルチ期間ボリンジャーモメンタムブレイクアウト戦略とハル移動平均戦略の組み合わせ

VWMA HMA BB MTF RSI
作成日: 2024-11-29 17:00:00 最終変更日: 2024-11-29 17:00:00
コピー: 0 クリック数: 507
1
フォロー
1617
フォロワー

マルチ期間ボリンジャーモメンタムブレイクアウト戦略とハル移動平均戦略の組み合わせ

概要

この戦略は,多時間枠分析に基づく取引システムで,ボリンジャー帯,ハル移動平均,加重移動平均を組み合わせて取引シグナルを生成する.戦略は,主に1時間の時間枠で動作し,5分,1時間,3時間の3つの時間周期の市場データを統合し,複数の技術指標の組み合わせによって取引機会を確認する.戦略は,ダイナミックなストップ・ストップ・ロスの仕組みを採用し,口座権益に応じて自動的にポジションサイズを調整し,リスクを効果的に制御する.

戦略原則

戦略の核心論理は,複数の技術指標の交叉確認に基づいている.複数の時間周期で同時に価格と各種の均線の関係を監視する.これには,5分周期の加重移動平均 (VWMA),1時間周期の加重移動平均 (WMA),3時間周期のハル移動平均 (HMA) が含まれる.価格がすべての時間周期の指標の上位にあるとき,システムは価格突破時に多信号を発生させる.逆に,価格がすべての指標の下位にあるとき,システムは価格突破時に空信号を発生させる.戦略はまた,偏差計算 (deviation) を導入し,ダイナミックな入場場場と出口を設定し,取引の柔軟性を高める.

戦略的優位性

  1. 複数のタイムサイクル分析により,偽突破のリスクを低減し,取引信号の信頼性を高めます.
  2. ダイナミックなストップ・ストップ・ロスの設定により,異なる市場環境に対応できます.
  3. 口座権益に基づくポジション管理により,資金の合理的な使用が保証されます.
  4. 複数の出場メカニズムの選択は,戦略の適応性を高めています.
  5. 分析と判断を容易にするために,明確な取引シグナル表示を提供するグラフィカルインタフェース
  6. 取引決定の正確さを高めるために,複数の成熟した技術指標を統合

戦略リスク

  1. 複数の指標を使用すると,取引信号が遅れる可能性があります.
  2. 不安定な市場では、誤ったブレイクアウトシグナルが頻繁に発生する可能性がある
  3. 固定ストップ・ストラスト比率は,すべての市場状況に適していない可能性があります.
  4. 複数の時間周期のデータ処理は,戦略の実行の複雑さを増加させる可能性があります.
  5. 高波動性のある市場では,滑りやすいリスクがある

戦略最適化の方向性

  1. 利益確定と損切りレベルを動的に調整するボラティリティ指標を導入
  2. 市場環境の認識機能を追加し,異なる市場状態で異なるパラメータ設定を使用
  3. シグナルフィルタリングを最適化し,偽突破による損失を減らす
  4. 取引量分析の追加により,突破信号の信頼性が向上
  5. 戦略の安定性を高めるための自己適応のパラメータ最適化メカニズムの開発

要約する

この戦略は,複数のタイムサイクル分析と複数の技術指標を組み合わせて,比較的完全な取引システムを構築している.戦略の優点は,信号の信頼性とリスク管理の有効性にあるが,同時に,信号の遅れやパラメータの最適化などの問題もある.継続的な最適化と改善により,戦略は,異なる市場環境で安定したパフォーマンスを維持すると見込まれている.

ストラテジーソースコード
/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-28 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("1H- 280, 2.7", overlay=true)


// Fetch the indicator values from different timeframes
vwma5 = request.security(syminfo.tickerid, "5", ta.wma(close, 233), lookahead = barmerge.lookahead_off)
vwma_hourly = request.security(syminfo.tickerid, "60", ta.wma(close, 89), lookahead = barmerge.lookahead_off)
hullma155_3h = request.security(syminfo.tickerid, "180", ta.hma(close, 155), lookahead = barmerge.lookahead_off)


// Calculate the deviation value
deviation = close * 0.032


// Initialize the signal variables
var float signalLine = na
var color lineColor = na


// Long Entry Conditions
longCondition_5min = close > vwma5
longCondition_hourly = close > vwma_hourly
longCondition_3h = close > hullma155_3h


// Short Entry Conditions
shortCondition_5min = close < vwma5
shortCondition_hourly = close < vwma_hourly
shortCondition_3h = close < hullma155_3h


// Long Entry
if longCondition_5min and longCondition_hourly and longCondition_3h
    signalLine := close + deviation
    lineColor := color.rgb(0, 255, 0, 1)


// Short Entry
if shortCondition_5min and shortCondition_hourly and shortCondition_3h
    signalLine := close - deviation
    lineColor := color.rgb(255, 0, 0, 1)


// Plotting the connecting line
plot(signalLine, title="Signal Line", color=lineColor, linewidth=1, style=plot.style_line)


// Colorize the signal line
bgcolor(signalLine > close ? color.rgb(0, 255, 0, 99) : color.rgb(255, 0, 0, 99), transp=90)



// Strategy settings
useTPSL = input(true, "Use TP/SL for closing long positions?")
useDownbreakOutbreak = input(false, "Use Downbreak and Outbreak for closing positions?")
useM7FClosing = input(false, "Use M7F Signal for closing positions?")


length1 = input.int(280, minval=1)
src = input(close, title="Source")
mult = input.float(2.7, minval=0.001, maxval=50, title="StdDev")


basis = ta.vwma(src, length1)
dev = mult * ta.stdev(src, length1)
upper = basis + dev
lower = basis - dev


offset = input.int(0, "Offset", minval = -500, maxval = 500)


length2 = input.int(55, minval=1)
src2 = input(close, title="Source")
hullma = ta.wma(2 * ta.wma(src2, length2 / 2) - ta.wma(src2, length2), math.floor(math.sqrt(length2)))


hullmacrosslower = ta.crossover(hullma, lower)
hullmacrossupper = ta.crossunder(hullma, upper)


breakout = ta.crossover(ohlc4, upper)
breakdown = ta.crossunder(ohlc4, upper)
outbreak = ta.crossover(ohlc4, lower)
downbreak = ta.crossunder(ohlc4, lower)


// Calculate position size and leverage
margin_pct = 1
leverage = 1
position_size = strategy.equity * margin_pct
qty = position_size / close / leverage


// Define take profit and stop loss levels
take_profit = 0.14
stop_loss = 0.06


// Opening a long position
if breakout
    strategy.entry("Long", strategy.long, qty, limit=close*(1+take_profit), stop=close*(1-stop_loss))


// Opening a short position
if downbreak
    strategy.entry("Short", strategy.short, qty, limit=close*(1-take_profit), stop=close*(1+stop_loss))


// Closing positions based on chosen method
if useTPSL
    // Using TP/SL for closing long positions
    if strategy.position_size > 0 and breakdown
        strategy.close("Long", comment="Breakdown")
else if useDownbreakOutbreak
    // Using Downbreak and Outbreak for closing positions
    if strategy.position_size > 0 and (breakdown or downbreak)
        strategy.close("Long", comment="Breakdown")
    if strategy.position_size < 0 and (outbreak or downbreak)
        strategy.close("Short", comment="Outbreak")
else if useM7FClosing
    // Using M7F Signal for closing positions
    if strategy.position_size > 0 and (signalLine < close)
        strategy.close("Long", comment="M7F Signal")
    if strategy.position_size < 0 and (signalLine > close)
        strategy.close("Short", comment="M7F Signal")


// Plotting entry signals
plotshape(hullmacrosslower, title="High Bear Volatility", style=shape.arrowup, text="^^^^^", color=color.rgb(75, 202, 79), location=location.belowbar)
plotshape(hullmacrossupper, title="High Bull Volatility", style=shape.arrowdown, text="-----", color=color.rgb(215, 72, 72), location=location.abovebar)
plotshape(breakout ? 1 : na, title="Breakout", style=shape.arrowup, text="", color=color.rgb(75, 202, 79), location=location.belowbar, size=size.tiny)
plotshape(breakdown ? 1 : na, title="Breakdown", style=shape.arrowdown, text="", color=color.rgb(201, 71, 71), location=location.abovebar, size=size.tiny)
plotshape(outbreak ? 1 : na, title="Outbreak", style=shape.arrowup, text="", color=color.rgb(0, 110, 255), location=location.belowbar, size=size.tiny)
plotshape(downbreak ? 1 : na, title="Downbreak", style=shape.arrowdown, text="", color=color.rgb(255, 111, 0), location=location.abovebar, size=size.tiny)