ダブル移動平均ゴールデンクロス戦略


作成日: 2023-09-15 15:50:20 最終変更日: 2023-09-15 15:50:20
コピー: 0 クリック数: 598
1
フォロー
1617
フォロワー

戦略概要

双均線ゴールドクロス戦略は,高速均線上を横切って遅い均線を生成する多多信号,高速均線下を横切って遅い均線を生成する空白信号を生成する単純な量化戦略である. この戦略は,市場における長期のトレンド転換点を判断するために双均線の黄金の交差点を捕捉する.

戦略原則

  1. 短期トレンドの代表として,50周期の急速な単純な移動平均を計算する.

  2. 長期トレンドの代表として,200周期のスロースピード・シンプル・モビング・アベアンを計算する.

  3. 速平均線が遅平均線を横切るときは,上昇の長期トレンドに入ると考えられ,このとき,多めにする.

  4. 急速平均線の下から慢速平均線を通過すると,下落の長期トレンドに入ると考えられ,多項保有を平らにする.

交差は市場における需要と供給の関係と心理的な変化を表し,長線としてトレンド転換を判断するシグナルである. 遅い平均線周期の組み合わせは,異なる品種と周期に応じて調整することができる.

戦略的優位性

  • 主なトレンドの転換点を判断する双均線

  • 黄金の交差点は,はっきりとした多空信号を形成する

  • パラメータ調整の柔軟性,多種多様な市場に対応

  • 復元とリッドディスクの調整は簡単

  • 他の因子と組み合わせて使用できる

リスク警告

  • 平均線は遅れている.

  • 偽の突破を防ぐ必要がある

  • 具体的には,入場・出場のタイミングは不明です.

  • トレンド内の変動が損失を招く可能性

要約する

双均線ゴールドクロス戦略は,平均線がより速く遅いゴールドクロス状況を比較して,長線トレンドの変化を判断する,広く適用される長線戦略考え方である.異なる市場状況に応じてパラメータを調整し,他の要因と組み合わせて使用して,戦略の効果を高める.

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

//@version=3


strategy("GoldenCross Strategy by Clefsphere",overlay=true, initial_capital=10000,default_qty_type=strategy.percent_of_equity,default_qty_value=100)

// testStartYear = input(2013, "Start Year")
// testStartMonth = input(3, "Start Month")
// testStartDay = input(1, "Start Day")
// testPeriodStart = timestamp(testStartYear,testStartMonth,testStartDay,0,0)

// testStopYear = input(2018, "Stop Year")
// testStopMonth = input(8, "Stop Month")
// testStopDay = input(5, "Stop Day")
// testPeriodStop = timestamp(testStopYear,testStopMonth,testStopDay,0,0)

// testPeriodBackground = input(title="Background", type=bool, defval=true)
// testPeriodBackgroundColor = testPeriodBackground and (time >= testPeriodStart) and (time <= testPeriodStop) ? #00FF00 : na


sma1Period = input(50, "Fast EMA Buy")
sma2Period = input(200, "Slow SMA Buy")

// testPeriod() =>
//     time >= testPeriodStart and time <= testPeriodStop ? true : false

sma1val=sma(close,sma1Period)
sma2val=sma(close,sma2Period)


plot(sma1val,color=blue,linewidth=1)
plot(sma2val,color=orange,linewidth=1)

long=crossover(sma1val,sma2val)
short=crossunder(sma1val,sma2val)


// if testPeriod()
if long
    strategy.entry("buy",strategy.long)
    
if short
    strategy.close("buy")
        
plot(low,color= sma1val > sma2val ? green:  red,style=columns,transp=90,linewidth=1)