リバウンドトレンドの二重移動平均取引システムとATRダイナミックストップロス最適化戦略を組み合わせた

EMA ATR SL TP MA
作成日: 2025-01-10 15:19:40 最終変更日: 2025-01-10 15:19:40
コピー: 1 クリック数: 454
1
フォロー
1617
フォロワー

リバウンドトレンドの二重移動平均取引システムとATRダイナミックストップロス最適化戦略を組み合わせた

概要

この戦略は、二重移動平均システムと ATR 動的ストップロスに基づくトレンド追従型取引システムです。 38 期間および 62 期間の指数移動平均 (EMA) を使用して市場のトレンドを特定し、高速 EMA との価格のクロスオーバーを通じてエントリー シグナルを決定し、それを ATR インジケーターと組み合わせて動的なストップ ロス管理を行います。この戦略は、さまざまなリスク嗜好を持つトレーダーに合わせて、積極的取引モードと保守的取引モードの両方を提供します。

戦略原則

戦略の中核となるロジックは、次の主要な要素に基づいています。

  1. トレンドの決定: 現在の市場トレンドは、38 期間 EMA と 62 期間 EMA の位置関係によって決定されます。高速 EMA が低速 EMA より上にある場合は上昇トレンド、そうでない場合は下降トレンドです。
  2. エントリー シグナル: 上昇トレンドでは、価格が高速 EMA を下から突破するとロング シグナルが生成されます。下降トレンドでは、価格が高速 EMA を上から下へ突破するとショート シグナルが生成されます。
  3. リスク管理: ATR に基づく動的なストップロス システムを使用することで、価格が有利な方向に動くとストップロス レベルがそれに応じて調整され、市場から早期に撤退することなく既存の利益が保護されます。固定パーセンテージのストップロスと利益目標も設定されます。

戦略的優位性

  1. 優れたトレンド追跡性能: デュアル移動平均システムは、中期および長期のトレンドを効果的に捉え、不安定な市場での頻繁な取引を回避できます。
  2. 完璧なリスク管理: 固定ストップロスと動的ストップロスを組み合わせることで、最大リスクを制限し、利益を保護することができます。
  3. 強力な適応性: 積極的と保守的の 2 つの取引モードを提供し、市場環境や個人のリスク嗜好に応じて柔軟に調整できます。
  4. 明確な視覚的フィードバック: 市場の状況と取引シグナルは、K ラインとさまざまな色の矢印マークを通じて直感的に表示されます。

戦略リスク

  1. トレンド反転リスク: トレンド反転ポイントで連続ストップが発生する可能性があります。トレンドが明確な場合にのみ取引することをお勧めします。
  2. スリッページリスク: 市場が激しく変動した場合、実際の取引価格がシグナル価格から大きく乖離する可能性があります。ストップロスの範囲は適切に緩和する必要があります。
  3. パラメータ感度: 移動平均期間と ATR 倍数の選択は、戦略のパフォーマンスに大きく影響します。さまざまな市場環境に合わせて最適化する必要があります。

戦略最適化の方向性

  1. トレンド強度フィルターの追加: ADX などのトレンド強度インジケーターを導入して、トレンドが明確な場合にのみ市場に参入できます。
  2. 最適化されたストップロス メカニズム: ATR 倍数はボラティリティに応じて動的に調整できるため、ストップロスの適応性が向上します。
  3. ボリューム確認を追加: エントリー信号が表示されたら、ボリューム分析と組み合わせて信号の信頼性を向上させます。
  4. 市場環境の分類: さまざまな市場環境 (トレンド/振動) に応じて戦略パラメータを動的に調整します。

要約する

この戦略は、古典的な二重移動平均システムと最新の動的ストップロス技術を組み合わせることで、完全なトレンド追従型取引システムを構築します。この戦略の利点は、完璧なリスク管理と強力な適応性ですが、トレーダーは特定の市場環境に応じてパラメータを最適化し、リスクを管理する必要があります。推奨される最適化の方向性を通じて、戦略の安定性と収益性がさらに向上することが期待されます。

ストラテジーソースコード
/*backtest
start: 2024-12-10 00:00:00
end: 2025-01-08 08:00:00
period: 4h
basePeriod: 4h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © aalapsharma

//@version=5
strategy(title="CM_SlingShotSystem - Strategy", shorttitle="SlingShotSys_Enhanced_v5", overlay=true, initial_capital=100000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, pyramiding=1)

// Inputs
sae = input.bool(true, "Show Aggressive Entry Bars? (Highlight only)")
sce = input.bool(true, "Show Conservative Entry Bars? (Highlight only)")
st = input.bool(true, "Show Trend Arrows (Top/Bottom)?")
def = input.bool(false, "(Unused) Only Choose 1 - Either Conservative Entry Arrows or 'B'-'S' Letters")
pa = input.bool(true, "Show Conservative Entry Arrows?")
sl = input.bool(false, "Show 'B'-'S' Letters?")
useStopLoss = input.bool(true, "Use Stop-Loss?")
stopLossPerc = input.float(5.0, "Stop-Loss (%)", step=0.1)
useTakeProfit = input.bool(true, "Use Take-Profit?")
takeProfitPerc = input.float(20.0, "Take-Profit (%)", step=0.1)
useTrailingStop = input.bool(false, "Use ATR Trailing Stop?")
atrLength = input.int(14, "ATR Length", minval=1)
atrMult = input.float(2.0, "ATR Multiple for Trailing Stop", step=0.1)

// Calculations
emaSlow = ta.ema(close, 62)
emaFast = ta.ema(close, 38)
upTrend = emaFast >= emaSlow
downTrend = emaFast < emaSlow
pullbackUpT() => emaFast > emaSlow and close < emaFast
pullbackDnT() => emaFast < emaSlow and close > emaFast
entryUpT() => emaFast > emaSlow and close[1] < emaFast and close > emaFast
entryDnT() => emaFast < emaSlow and close[1] > emaFast and close < emaFast
entryUpTrend = entryUpT() ? 1 : 0
entryDnTrend = entryDnT() ? 1 : 0
atrValue = ta.atr(atrLength)

// Trailing Stop Logic (Improved)
var float trailStopLong = na
var float trailStopShort = na

if (strategy.position_size > 0)
    trailStopLong := math.max(close - (atrValue * atrMult), nz(trailStopLong[1], close))
    trailStopLong := strategy.position_avg_price > trailStopLong ? strategy.position_avg_price : trailStopLong
else
    trailStopLong := na

if (strategy.position_size < 0)
    trailStopShort := math.min(close + (atrValue * atrMult), nz(trailStopShort[1], close))
    trailStopShort := strategy.position_avg_price < trailStopShort ? strategy.position_avg_price : trailStopShort
else
    trailStopShort := na

// Plotting
col = emaFast > emaSlow ? color.lime : emaFast < emaSlow ? color.red : color.yellow
p1 = plot(emaSlow, "Slow MA (62)", linewidth=4, color=col)
p2 = plot(emaFast, "Fast MA (38)", linewidth=2, color=col)
fill(p1, p2, color=color.silver, transp=50)
barcolor((sae and pullbackUpT()) ? color.yellow : (sae and pullbackDnT()) ? color.yellow : na)
barcolor((sce and entryUpT()) ? color.aqua : (sce and entryDnT()) ? color.aqua : na)
plotshape(st and upTrend, title="Trend UP", style=shape.triangleup, location=location.bottom, color=color.lime)
plotshape(st and downTrend, title="Trend DOWN", style=shape.triangledown, location=location.top, color=color.red)
plotarrow((pa and entryUpTrend == 1) ? 1 : na, title="Up Entry Arrow", colorup=color.lime, maxheight=30, minheight=30)
plotarrow((pa and entryDnTrend == 1) ? -1 : na, title="Down Entry Arrow", colordown=color.red, maxheight=30, minheight=30)
plotchar(sl and entryUpTrend ? (low - ta.tr) : na, title="Buy Entry (Letter)", char='B', location=location.absolute, color=color.lime)
plotchar(sl and entryDnTrend ? (high + ta.tr) : na, title="Short Entry (Letter)", char='S', location=location.absolute, color=color.red)
plot(useTrailingStop and strategy.position_size > 0 ? trailStopLong : na, "Trailing Stop Long", color=color.green, style=plot.style_linebr)
plot(useTrailingStop and strategy.position_size < 0 ? trailStopShort : na, "Trailing Stop Short", color=color.red, style=plot.style_linebr)

// Function to calculate stop and limit prices
f_calcStops(_entryPrice, _isLong) =>
    _stopLoss = _isLong ? _entryPrice * (1.0 - stopLossPerc / 100.0) : _entryPrice * (1.0 + stopLossPerc / 100.0)
    _takeProfit = _isLong ? _entryPrice * (1.0 + takeProfitPerc / 100.0) : _entryPrice * (1.0 - takeProfitPerc / 100.0)
    [_stopLoss, _takeProfit]

// Entry and Exit Logic (Simplified using strategy.close)
if (entryUpT() and strategy.position_size == 0)
    strategy.entry("Long", strategy.long)

if (entryDnT() and strategy.position_size == 0)
    strategy.entry("Short", strategy.short)

// Exit conditions based on Stop-loss and Take-profit
[slPrice, tpPrice] = f_calcStops(strategy.position_avg_price, strategy.position_size > 0)

if (strategy.position_size > 0)
    strategy.exit("Exit Long", "Long", stop=slPrice, limit=tpPrice, trail_price = trailStopLong, trail_offset = atrValue * atrMult)

if (strategy.position_size < 0)
    strategy.exit("Exit Short", "Short", stop=slPrice, limit=tpPrice, trail_price = trailStopShort, trail_offset = atrValue * atrMult)

// Close opposite position on new entry signal
if (entryUpT() and strategy.position_size < 0)
    strategy.close("Short", comment="Close Short on Long Signal")

if (entryDnT() and strategy.position_size > 0)
    strategy.close("Long", comment="Close Long on Short Signal")