ダイナミックマルチインジケータートレンドフォローデイトレード戦略

EMA RSI MACD ATR IST
作成日: 2025-02-21 13:15:30 最終変更日: 2025-02-21 13:15:30
コピー: 0 クリック数: 365
2
フォロー
319
フォロワー

ダイナミックマルチインジケータートレンドフォローデイトレード戦略 ダイナミックマルチインジケータートレンドフォローデイトレード戦略

概要

これは,複数の技術指標に基づく1日間の取引戦略であり,主にEMAチャネル,RSI超買い超売り,MACDトレンド確認などの複数のシグナルを使用して取引されます.この戦略は,3分周期で動作し,EMAの高低軌道とRSIとMACDの交差確認を組み合わせて,ATRベースのダイナミックなストップ・ローズと固定されたクローズオフ・平仓時間を設定して市場トレンドを捉えます.

戦略原則

戦略は20周期EMAを使用して,最高価格と最低価格をそれぞれ計算し,チャネルを形成し,価格がチャネルを突破し,以下の条件を満たしたときに入場する.

  1. 多頭入場:閉盤価格でEMA高線,RSIが50-70の間,MACD線で信号線を穿越する
  2. 空頭入場:閉盤価格の下のEMA低線,RSIは30-50の間で,MACD線の下の信号線を通過
  3. ATRの動的計算によるストップポジション,2.5倍リスク/利益比でストップセット
  4. 各取引のリスクは口座の1%で,ストップダスト距離の動的に計算されるポジションのサイズ
  5. インド標準時間15:00からすべてのポジションに強制平仓

戦略的優位性

  1. 複数の技術指標のクロス検証により,取引信号の信頼性が向上
  2. 動的ストップはATR指数に基づいており,市場の波動に適しています.
  3. 固定リスク比とリスク収益比で,リスクを効果的にコントロールする
  4. 取引コストを考慮し,手数料を含む
  5. 同方向投資を禁止し,過度の投資リスクを避ける
  6. 閉店時刻を固定して夜更かしを避ける

戦略リスク

  1. 複数の指標が信号の遅延を引き起こし,入場時刻に影響を与える可能性がある
  2. EMAチャネルは横軸市場で頻繁に偽ブレイクを起こす可能性があります.
  3. 固定リスク/利益の比率は,異なる市場環境では柔軟性がない可能性があります.
  4. RSIの区間制限は,いくつかの大きなトレンドを見逃している可能性があります.
  5. 強制的な平定は,重要な位置から撤退を迫る可能性がある.

戦略最適化の方向性

  1. 取引量指標の追加を補助的な確認として検討
  2. リスク/リターン比率は,変動特性の変動により,異なる時間帯に合わせて調整できます.
  3. 市場変動指数の動的調整RSI値下げを導入する
  4. トレンド強度フィルターを増加させ,偽突破を減らすことを検討する
  5. 日中の異なる時間帯特性を考慮してパラメータの調整を考慮することができます.
  6. ポジション管理を最適化するために,歴史変動率分析を追加

要約する

この戦略は,複数の技術指標の配合により,比較的完全な取引システムを構築している.この戦略の優点は,リスク管理がより完善であることであり,ダイナミックストップ,固定リスク,クローズオフ等を含む仕組みである.ある程度の遅れのリスクがあるものの,パラメータの最適化と補助指標の追加によって戦略のパフォーマンスをさらに向上させることができる.この戦略は,特に波動的な日内取引市場には適しており,厳格なリスク管理と複数のシグナル確認によって安定した利益を得ることができる.

ストラテジーソースコード
/*backtest
start: 2024-02-21 00:00:00
end: 2024-09-09 00:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Binance","currency":"ETH_USDT"}]
*/

//@version=6
strategy("Intraday 3min EMA HL Strategy v6", 
     overlay=true,
     margin_long=100, 
     margin_short=100,
     initial_capital=100000,
     default_qty_type=strategy.percent_of_equity,
     default_qty_value=100,
     commission_type=strategy.commission.percent,
     commission_value=0.05,
     calc_on_every_tick=false,
     process_orders_on_close=true,
     pyramiding=0)

// Input Parameters
i_emaLength = input.int(20, "EMA Length", minval=5, group="Strategy Parameters")
i_rsiLength = input.int(14, "RSI Length", minval=5, group="Strategy Parameters")
i_atrLength = input.int(14, "ATR Length", minval=5, group="Risk Management")
i_rrRatio = input.float(2.5, "Risk:Reward Ratio", minval=1, maxval=10, step=0.5, group="Risk Management")
i_riskPercent = input.float(1, "Risk % per Trade", minval=0.1, maxval=5, step=0.1, group="Risk Management")

// Time Exit Parameters (IST)
i_exitHour = input.int(15, "Exit Hour (IST)", minval=0, maxval=23, group="Session Rules")
i_exitMinute = input.int(0, "Exit Minute (IST)", minval=0, maxval=59, group="Session Rules")

// Indicator Calculations
emaHigh = ta.ema(high, i_emaLength)
emaLow = ta.ema(low, i_emaLength)

rsi = ta.rsi(close, i_rsiLength)
atr = ta.atr(i_atrLength)

fastMA = ta.ema(close, 12)
slowMA = ta.ema(close, 26)
macdLine = fastMA - slowMA
signalLine = ta.ema(macdLine, 9)

// Time Calculations (UTC to IST Conversion)
istHour = (hour(time) + 5) % 24  // UTC+5
istMinute = minute(time) + 30    // 30 minute offset
istHour += istMinute >= 60 ? 1 : 0
istMinute := istMinute % 60

// Exit Condition
timeExit = istHour > i_exitHour or (istHour == i_exitHour and istMinute >= i_exitMinute)

// Entry Conditions (Multi-line formatting fix)
longCondition = close > emaHigh and
     rsi > 50 and
     rsi < 70 and
     ta.crossover(macdLine, signalLine)

shortCondition = close < emaLow and
     rsi < 50 and
     rsi > 30 and
     ta.crossunder(macdLine, signalLine)

// Risk Calculations
var float entryPrice = na
var float stopLoss = na
var float takeProfit = na
var float posSize = na

// Strategy Logic
if longCondition and not timeExit and strategy.position_size == 0
    entryPrice := close
    stopLoss := math.min(low, entryPrice - atr)
    takeProfit := entryPrice + (entryPrice - stopLoss) * i_rrRatio
    posSize := strategy.equity * i_riskPercent / 100 / (entryPrice - stopLoss)
    strategy.entry("Long", strategy.long, qty=posSize)
    strategy.exit("Long Exit", "Long", stop=stopLoss, limit=takeProfit)

if shortCondition and not timeExit and strategy.position_size == 0
    entryPrice := close
    stopLoss := math.max(high, entryPrice + atr)
    takeProfit := entryPrice - (stopLoss - entryPrice) * i_rrRatio
    posSize := strategy.equity * i_riskPercent / 100 / (stopLoss - entryPrice)
    strategy.entry("Short", strategy.short, qty=posSize)
    strategy.exit("Short Exit", "Short", stop=stopLoss, limit=takeProfit)

// Force Close at Session End
if timeExit
    strategy.close_all()

// Visual Components
plot(emaHigh, "EMA High", color=color.rgb(0, 128, 0), linewidth=2)
plot(emaLow, "EMA Low", color=color.rgb(255, 0, 0), linewidth=2)

plotshape(longCondition, "Long Signal", shape.triangleup, 
  location.belowbar, color=color.green, size=size.small)
plotshape(shortCondition, "Short Signal", shape.triangledown, 
  location.abovebar, color=color.red, size=size.small)

// Debugging Table
var table infoTable = table.new(position.top_right, 3, 3)
if barstate.islast
    table.cell(infoTable, 0, 0, "EMA High: " + str.tostring(emaHigh, "#.00"))
    table.cell(infoTable, 0, 1, "EMA Low: " + str.tostring(emaLow, "#.00"))
    table.cell(infoTable, 0, 2, "Current RSI: " + str.tostring(rsi, "#.00"))