モメンタムダブル移動平均クロスオーバー戦略


作成日: 2023-10-20 16:44:30 最終変更日: 2023-10-20 16:44:30
コピー: 1 クリック数: 618
1
フォロー
1617
フォロワー

モメンタムダブル移動平均クロスオーバー戦略

概要

この戦略は,均線交差を利用して価格動力の方向を判断し,金叉死叉で全体的なトレンドを判断し,トレンド追跡を実現する.

戦略原則

この策略は,EMAとSMAの2つの均線の交差を用い,価格動力の方向を判断する.EMAは反応がより速く,SMAは反応がより安定する. SMAの上を通るときは,価格上昇の勢いが強いと判断し,多額にする. SMA下を通るときは,価格下落の勢いが強いと判断し,空きにする.

また,この戦略は,高速周期SMAと遅い周期SMAの交差を用いて,全体的なトレンドの方向を判断する.高速SMA上の遅い周期SMAを横切るときは金叉で,長期上昇傾向にあると判断する.高速SMA下の遅い周期SMAを横切るときは死叉で,長期下落傾向にあると判断する.

戦略がEMAでSMAを横切るときは,多額のチャンスであると判断する.この時金叉である場合,多額のチャンスが短期的な動力のサポートだけでなく,長期のトレンドと一致することを示す,これは良い多額のチャンスである.この時死叉である場合,多額のチャンスが短期的な動力のサポートのみであり,長期のトレンドと一致しないことを示す,これはより危険な多額のチャンスである.

優位分析

  • 平均線交差を用いて価格の動きと方向を判断する
  • 短期的動力と長期的傾向を考慮する
  • 双指数確認信号と組み合わせると,信頼性が高い.
  • 平均線パラメータを調整することで,異なる周期に対応できます.
  • 特定取引シグナルを表示するかどうかを設定し,インタフェースをカスタマイズできます.

リスク分析

  • 平均線交差が遅れているため,ベストバイズ・セール・ポイントを逃す可能性があります.
  • 固定サイクルのSMAは,価格変化をリアルタイムで反映できない
  • 長短周期平均線は誤った交差信号を生成する可能性がある
  • 長期にわたって資金のリスクを増加させる可能性

他の指標と組み合わせて信号を確認し,均線周期パラメータを最適化したり,ストップ・ロスを設定することでリスクを低減することができる.

最適化の方向

  • 取引量,ブリン帯などの他の指標のフィルターを追加します.
  • ストップ・ロスの策略を増やす
  • 平均線周期パラメータを最適化
  • 資金管理の最適化
  • ポジション比率をリアルタイムで調整する

要約する

この戦略は,全体として,より安定した信頼性の高いトレンド追跡戦略である.それは,短期価格の動きと長期のトレンド方向を同時に考慮し,均線交差によって取引信号を形成する.単一の均線戦略と比較して,それは,二重指標確認を組み合わせて,信頼性が高い.しかし,トレンド追跡戦略として,そのパラメータ最適化とリスク管理は,戦略の効果を本当に発揮するには,繰り返しテストと調整が不可欠である.継続的な最適化と改善により,この戦略は,長期にわたって保持する価値のある量化投資のポートフォリオの構成部分になることができます.

ストラテジーソースコード
/*backtest
start: 2023-09-19 00:00:00
end: 2023-10-19 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Cryptoluc1d

//@version=4
strategy("Equal-Length EMA/SMA Crossover Strategy", initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=25, commission_type=strategy.commission.percent, commission_value=0.2, overlay=true)

// Create inputs

mom_length = input(title="Momentum Length (EMA=SMA)", defval=50)
bias_length_fast  = input(title="Golden Cross Length (Fast)", defval=50)
bias_length_slow  = input(title="Golden Cross Length (Slow)", defval=100)

// Define MAs

ema = ema(close, mom_length) // EMA/SMA crossover of the same period for detecting trend acceleration/deceleration
sma = sma(close, mom_length)
bias_fast = sma(close, bias_length_fast) // golden/death cross for overall trend bias
bias_slow = sma(close, bias_length_slow)

// Define signal conditions

buy_trend = crossover(ema, sma) and bias_fast >= bias_slow // buy when EMA cross above SMA. if this happens during a bullish golden cross, buying is in confluence with the overall trend (bias).
buy_risky = crossover(ema, sma) and bias_fast < bias_slow // buy when EMA cross above SMA. if this happens during a bearish death cross, buying is early, more risky, and not in confluence with the overall trend (bias).
buy_late = crossover(sma, bias_slow) and ema > sma // the SMA crossing the Slow_SMA gives further confirmation of bullish trend, but signal comes later.
sell = crossunder(ema, sma) // sell when EMA cross under SMA.

// Enable option to hide signals, then plot signals

show_signal = input(title="Show Signals", defval=true)

plotshape(show_signal ? buy_trend : na, title='Trend Buy', style=shape.triangleup, location=location.belowbar, color=color.green, text='TREND BUY')
plotshape(show_signal ? buy_risky : na, title='Risky Buy', style=shape.triangleup, location=location.belowbar, color=color.olive, text='RISKY BUY')
plotshape(show_signal ? buy_late : na, title='Late Buy', style=shape.triangleup, location=location.belowbar, color=color.lime, text='LATE BUY')
plotshape(show_signal ? sell : na, title='Sell', style=shape.triangledown, location=location.abovebar, color=color.red, text='SELL')

// Define entry and exit conditions

longCondition = ema > sma and bias_fast >= bias_slow // LONG when EMA above SMA, and overall trend bias is bullish
if (longCondition)
    strategy.entry("BUY TREND", strategy.long)
exitLong = crossunder(ema, sma) // close LONG when EMA cross under SMA
strategy.close("BUY TREND", when=exitLong)

// // short conditions. turned off because up only.
// shortCondition = ema < sma and bias_fast <= bias_slow // SHORT when EMA under SMA, and overall trend bias is bearish
// if (shortCondition)
//     strategy.entry("SELL TREND", strategy.short)
// exitShort = crossover(ema, sma) // close SHORT when EMA cross over SMA
// strategy.close("SELL TREND", when=exitShort)

// Enable option to show MAs, then plot MAs

show_ma = input(title="Show MAs", defval=false)

plot(show_ma ? ema : na, title="Momentum EMA", color=color.green, linewidth=1)
plot(show_ma ? sma : na, title="Momentum SMA", color=color.yellow, linewidth=1)
plot(show_ma ? bias_fast : na, title="Golden Cross SMA (Fast)", color=color.orange, linewidth=2)
plot(show_ma ? bias_slow : na, title="Golden Cross SMA (Slow)", color=color.red, linewidth=2)