マルチタイムフレームの確率的トレンドフォロー取引戦略

EMA ATR MTF ROI TP SL
作成日: 2025-02-18 17:53:04 最終変更日: 2025-02-18 17:53:04
コピー: 1 クリック数: 360
1
フォロー
1617
フォロワー

マルチタイムフレームの確率的トレンドフォロー取引戦略

概要

この戦略は,多時枠ランダム指標 ((Stochastic) と指数移動平均 ((EMA) を組み合わせたトレンド追跡取引システムである.これは,高時枠ランダム指標によって,超買超売条件を判断し,同時に,トレンドフィルターとしてEMAを使用し,ダイナミックポジション管理とストップロスを追跡する機能を統合し,完全な取引戦略システムである.

戦略原則

戦略の核心的な論理は,以下の重要な要素に基づいています.

  1. 高時枠のランダムな指標を使用して,超買超売領域を識別し,K線と超買超売レベルとの交差によって潜在的な取引信号を決定する
  2. EMAをトレンドフィルターとして使用し,価格がEMAの上部に多めに,EMA下部に空いてください
  3. ATRの動的計算による止損と利益の目標,止損距離はATRの1.5倍,利益の目標の2倍
  4. アカウントリスクパーセントに基づくダイナミックポジション計算方法を使用して,各取引のリスクが既定のレベルで管理されることを保証します.
  5. 選択可能な追跡停止機能,追跡距離の1.5倍ATR

戦略的優位性

  1. 多重信号確認:高時枠ランダム指標とEMAトレンドフィルターを組み合わせて,信号の信頼性を向上させる
  2. 優れたリスク管理: 百分比のリスク管理により,資金の安全性を確保する
  3. フレキシブルなストップ・メカニズム: 固定ストップとストップ・トラッキングをサポートし,異なる市場環境に対応
  4. 明確な取引提醒: システムで自動的に入場点,ストップ・ロスト・ポイント,ターゲット・ポイントをマークし,取引を容易に実行する
  5. ダイナミックなポジション管理:変動に応じて取引規模を自動的に調整し,資金利用効率を最適化

戦略リスク

  1. トレンド反転のリスク: 市場が激しく揺れ動いていると誤った信号が出る可能性
  2. スライドポイントリスク:市場流動性が不足したときに大きなスライドポイントに直面する可能性があります.
  3. パラメタセンシビリティ: 策略のパフォーマンスはパラメタ設定に敏感であり,注意深く最適化する必要があります.
  4. 市場が激しく波動すると,より大きな撤退が起こる可能性がある.
  5. ストップをトリガーするリスク: ストップを追跡し,波動が強くなると過早にトリガーされる可能性があります.

戦略最適化の方向性

  1. 市場環境フィルターを追加:変動率指数またはトレンド強度指数を追加し,異なる市場環境で戦略パラメータを調整できます.
  2. 信号確認の最適化: 取引量確認または他の技術指標を補助判断として追加することを考慮する
  3. ポジション管理の改善:市場の波動的な動向に基づいてリスクの割合を調整できる
  4. 改善されたストップ・メカニズム: ストップ・距離の追跡は,市場特有の動向に合わせて調整できます.
  5. タイムフィルターで追加:重要な時期の取引制限を考慮し,重要なニュースリリース中のリスクを避ける

要約する

この戦略は,マルチタイムフレーム分析とマルチシグナル確認メカニズムを組み合わせて,完善したリスク管理システムと組み合わせて,比較的完全な取引システムを構築しています.一定のリスクがあるにもかかわらず,継続的な最適化と改善により,この戦略は,異なる市場環境で安定したパフォーマンスを維持すると見込まれています.

ストラテジーソースコード
/*backtest
start: 2024-02-19 00:00:00
end: 2025-02-17 00:00:00
period: 3h
basePeriod: 3h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("Ultimate fairas Oil", overlay=true)

// === Input Parameter ===
k_period = input(14, "K Period")
d_period = input(3, "D Period")
smooth_k = input(3, "Smooth K")
overbought = input(80, "Overbought Level")
oversold = input(20, "Oversold Level")
atrMult = input(1.5, "ATR Multiplier")
use_trailing_stop = input(true, "Enable Trailing Stop")
ema_length = input(50, "EMA Length")
risk_percent = input(2, "Risk per Trade (%)") / 100
account_balance = input(50000, "Account Balance")
mtf_tf = input.timeframe("D", "Higher Timeframe for Stochastic")

// === Multi-Timeframe Stochastic ===
stoch_source = request.security(syminfo.tickerid, mtf_tf, ta.stoch(close, high, low, k_period))
k = ta.sma(stoch_source, smooth_k)

// === Trend Filter (EMA) ===
ema = ta.ema(close, ema_length)
trendUp = close > ema
trendDown = close < ema

// === Entry Conditions ===
longCondition = ta.crossover(k, oversold) and trendUp
shortCondition = ta.crossunder(k, overbought) and trendDown

// === ATR-Based Stop Loss & Take Profit ===
atrValue = ta.atr(14)
stopLoss = atrMult * atrValue
takeProfit = 2 * stopLoss

// === Dynamic Lot Sizing (Risk Management) ===
risk_amount = account_balance * risk_percent
position_size = risk_amount / stopLoss

// === Trailing Stop Calculation ===
trailOffset = atrValue * 1.5
trailStopLong = use_trailing_stop ? close - trailOffset : na
trailStopShort = use_trailing_stop ? close + trailOffset : na

// === Execute Trades ===
if longCondition
    strategy.entry("Long", strategy.long, qty=position_size)
    strategy.exit("Exit Long", from_entry="Long", stop=close - stopLoss, limit=close + takeProfit, trail_points=use_trailing_stop ? trailOffset : na)

    // // Labels & Lines
    // label.new(x=bar_index, y=close, text="BUY", color=color.green, textcolor=color.white, size=size.small, style=label.style_label_down)
    // label.new(x=bar_index, y=close + takeProfit, text="TP 🎯", color=color.blue, textcolor=color.white, size=size.tiny)
    // label.new(x=bar_index, y=close - stopLoss, text="SL ❌", color=color.red, textcolor=color.white, size=size.tiny)
    // line.new(x1=bar_index, y1=close + takeProfit, x2=bar_index + 5, y2=close + takeProfit, width=2, color=color.blue)
    // line.new(x1=bar_index, y1=close - stopLoss, x2=bar_index + 5, y2=close - stopLoss, width=2, color=color.red)

    // Alert
    alert("BUY Signal! TP: " + str.tostring(close + takeProfit) + ", SL: " + str.tostring(close - stopLoss) + ", Lot Size: " + str.tostring(position_size), alert.freq_once_per_bar_close)

if shortCondition
    strategy.entry("Short", strategy.short, qty=position_size)
    strategy.exit("Exit Short", from_entry="Short", stop=close + stopLoss, limit=close - takeProfit, trail_points=use_trailing_stop ? trailOffset : na)

    // // Labels & Lines
    // label.new(x=bar_index, y=close, text="SELL", color=color.red, textcolor=color.white, size=size.small, style=label.style_label_up)
    // label.new(x=bar_index, y=close - takeProfit, text="TP 🎯", color=color.blue, textcolor=color.white, size=size.tiny)
    // label.new(x=bar_index, y=close + stopLoss, text="SL ❌", color=color.green, textcolor=color.white, size=size.tiny)
    // line.new(x1=bar_index, y1=close - takeProfit, x2=bar_index + 5, y2=close - takeProfit, width=2, color=color.blue)
    // line.new(x1=bar_index, y1=close + stopLoss, x2=bar_index + 5, y2=close + stopLoss, width=2, color=color.green)

    // Alert
    alert("SELL Signal! TP: " + str.tostring(close - takeProfit) + ", SL: " + str.tostring(close + stopLoss) + ", Lot Size: " + str.tostring(position_size), alert.freq_once_per_bar_close)