最適化された平均真の範囲に基づくトレンド戦略 v6(固定トレンドキャプチャ)

ATR EMA SMMA RSI TSL
作成日: 2025-03-31 16:50:30 最終変更日: 2025-03-31 16:50:41
コピー: 0 クリック数: 417
2
フォロー
319
フォロワー

最適化された平均真の範囲に基づくトレンド戦略 v6(固定トレンドキャプチャ) 最適化された平均真の範囲に基づくトレンド戦略 v6(固定トレンドキャプチャ)

概要

これは,平均リアルレンジ (ATR) に基づくトレンド追跡戦略で,複数の技術指標を組み合わせて高確率の取引を捉えることを目的としています. この戦略は,ATRフィルター,スーパートレンド指標,インデックス移動平均 (EMA) とシンプル移動平均 (SMMA) のトレンド帯,比較的強いインデックス (RSI) の確認,およびダイナミックストップシステムの融合を目的として,包括的で柔軟な取引方法を提供します.

戦略原則

戦略の核心は,複数の技術指標の協働に基づいています.

  1. トレンド識別:スーパートレンド指標 ((パラメータ:因数2,長さ5) と50日EMAと8日SMMAのトレンドを用い,市場のトレンド方向を定義する.トレンドは,色でコード化される:

    • 緑色: の傾向
    • 赤: 減速傾向
    • 灰色:中性期
  2. ATRスマートフィルター:14周期ATRと50周期SMAで波動的な拡大を検知し,ATRが上昇した場合またはそのSMAの101%以上で取引するだけで,強いトレンドでのみ入場を保証する.

  3. 応募条件:

    • 多入場:50日EMAより高い価格,超トレンドの看板,RSI > 45,ATRのトレンドの強さを確認する
    • 空調入場:50日EMA以下,超トレンド下落,RSI < 45,ATRがトレンドの強さを確認する
  4. ダイナミック・ストップ・アンド・ストップ:

    • 停止:ATRの5倍による自律停止
    • ストップ損失: 3.5倍ATRの追跡ストップ
    • 価格がATRを2倍に移動した後に起動する
    • 固定ストップ:0.8倍ATRの倍数を使用してリスク管理

戦略的優位性

  1. 波動性のある市場を効果的にフィルターし,低波動性地域での取引を避ける
  2. 過剰取引を防止し,早期再入場を防止する.
  3. 強いトレンドを捉え,ストップを追跡することで,利益が持続します.
  4. ATR ベースストップで大損失を防ぐ
  5. パラメータは調整可能で,異なる市場に対応して微調整できるATR倍数,ストップ・ロズ,ストップ・ストップとRSIフィルター

戦略リスク

  1. 技術指標への過度な依存は,偽信号を引き起こす可能性があります.
  2. 市場が揺れ動いている中で,
  3. パラメータの不適切な設定は取引コストを増加させる可能性があります.
  4. RSIは,急速なトレンドの変化を逃した可能性があることを確認しました.

戦略最適化の方向性

  1. 機械学習アルゴリズムを導入し,パラメータを動的に調整する
  2. 追加フィルタを追加します.
  3. 異なる市場と時間枠における最適なパラメータの組み合わせを探索する
  4. 複数の時間枠の検証メカニズムを開発する

要約する

これは高度なトレンド追跡戦略であり,多指標の協同性とダイナミックなリスク管理により,トレーダーに柔軟で強力な取引ツールを提供します.継続的な反省と最適化は,この戦略を成功的に適用する鍵です.

ストラテジーソースコード
/*backtest
start: 2024-03-31 00:00:00
end: 2025-03-29 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"ETH_USDT"}]
*/

//@version=6
strategy("Optimized ATR-Based Trend Strategy v6 (Fixed Trend Capture)", overlay=true)

// 🔹 Input parameters
lengthSMMA = input(8, title="SMMA Length")
lengthEMA = input(50, title="EMA Length")
supertrendFactor = input(2.0, title="Supertrend Factor")
supertrendLength = input(5, title="Supertrend Length")
atrLength = input(14, title="ATR Length")  
atrSmoothing = input(50, title="ATR Moving Average Length")  
atrMultiplierTP = input.float(5.0, title="ATR Multiplier for Take-Profit", minval=1.0, step=0.5)  
atrMultiplierTSL = input.float(3.5, title="ATR Multiplier for Trailing Stop-Loss", minval=1.0, step=0.5)  // 🔹 Increased to ride trends
atrStopMultiplier = input.float(0.8, title="ATR Stop Multiplier", minval=0.5, step=0.1)  
breakEvenMultiplier = input.float(2.0, title="Break-Even Trigger ATR Multiplier", minval=1.0, step=0.1)
rsiLength = input(14, title="RSI Length")  

// 🔹 Indicator calculations
smma8 = ta.sma(ta.sma(close, lengthSMMA), lengthSMMA)  
ema50 = ta.ema(close, lengthEMA)  

// 🔹 Supertrend Calculation
[superTrend, _] = ta.supertrend(supertrendFactor, supertrendLength)

// 🔹 Supertrend Conditions
isBullishSupertrend = close > superTrend
isBearishSupertrend = close < superTrend

// 🔹 ATR Calculation for Smarter Filtering
atrValue = ta.atr(atrLength)
atrMA = ta.sma(atrValue, atrSmoothing)
atrRising = ta.rising(atrValue, 3)  // 🔹 More sensitive ATR detection
isTrending = atrValue > atrMA * 1.01 or atrRising  // 🔹 Loosened ATR filter

// 🔹 RSI Calculation
rsi = ta.rsi(close, rsiLength)

// 🔹 RSI Conditions (More Flexible)
isRSIBullish = rsi > 45  // 🔹 Lowered to capture early trends
isRSIBearish = rsi < 45  

// 🔹 TP Lock Mechanism
var bool tpHit = false  
if strategy.position_size == 0 and strategy.closedtrades > 0
    tpHit := true  

// 🔹 Supertrend Flip Detection (Resumes Trading After Trend Change)
trendFlip = (isBullishSupertrend and not isBullishSupertrend[1]) or (isBearishSupertrend and not isBearishSupertrend[1])
if trendFlip
    tpHit := false  

// 🔹 Entry Conditions
bullishEntry = close > ema50 and isBullishSupertrend and isRSIBullish and isTrending and not tpHit
bearishEntry = close < ema50 and isBearishSupertrend and isRSIBearish and isTrending and not tpHit

// 🔹 Dynamic Take-Profit, Stop-Loss, and Break-Even Stop
longTakeProfit = close + (atrValue * atrMultiplierTP)  
shortTakeProfit = close - (atrValue * atrMultiplierTP)  
longTrailStop = atrValue * atrMultiplierTSL  
shortTrailStop = atrValue * atrMultiplierTSL  

// ✅ Adjusted SL to Reduce Drawdown
longStopLoss = close - (atrValue * atrMultiplierTSL * atrStopMultiplier)
shortStopLoss = close + (atrValue * atrMultiplierTSL * atrStopMultiplier)

// ✅ Break-Even Stop Trigger (More Room for Trends)
longBreakEven = strategy.position_avg_price + (atrValue * breakEvenMultiplier)
shortBreakEven = strategy.position_avg_price - (atrValue * breakEvenMultiplier)

// 🔹 Strategy Execution (Fixed Take-Profit & Stop-Loss)
if (bullishEntry)
    strategy.entry("Buy", strategy.long)
    strategy.exit("TSL/TP", from_entry="Buy", stop=longStopLoss, trail_offset=longTrailStop, limit=longTakeProfit)
    strategy.exit("BreakEven", from_entry="Buy", stop=longBreakEven)

if (bearishEntry)
    strategy.entry("Sell", strategy.short)
    strategy.exit("TSL/TP", from_entry="Sell", stop=shortStopLoss, trail_offset=shortTrailStop, limit=shortTakeProfit)
    strategy.exit("BreakEven", from_entry="Sell", stop=shortBreakEven)

// 🔹 Trend Band
trendColor = isBullishSupertrend and smma8 > ema50 and close > ema50 ? color.green :
             isBearishSupertrend and smma8 < ema50 and close < ema50 ? color.red : color.gray
fill(plot(smma8, color=color.new(trendColor, 60), title="8 SMMA Band"),
     plot(ema50, color=color.new(trendColor, 60), title="50 EMA Band"),
     color=color.new(trendColor, 80), title="Trend Band")

// 🔹 Supertrend Line
plot(superTrend, color=color.gray, title="Supertrend", style=plot.style_line)