二重移動平均値ジャンプ戦略

作者: リン・ハーンチャオチャン, 日付: 2023-11-21 14:28:35
タグ:

img

概要

この戦略は,価格が急上昇するときにロングまたはショートポジションを開く機会を特定するために,急,中,緩やかな移動平均線で構築されたトレンド判断システムと組み合わせて,過剰購入および過剰売却条件を決定するために,RSI指標を使用します.

戦略原則

  1. RSI インディケーターを使用して,過剰購入および過剰販売条件を決定します.

    • RSI パラメータは14期に設定されています.
    • 売れ過ぎのラインは30で 売れ過ぎのラインは70で
  2. トレンドを決定するために,異なる期間の3つのSMA線を使用します.

    • 短期のトレンドを表す 9 期間の SMA です.
    • 中間線は50期SMAで 中期トレンドを表しています
    • スローラインは200期SMAで,長期トレンドを表しています.
  3. 高速線が中間線を超えると,RSIインジケーターが過売りを示します.

  4. 急速線が中間線を下回り,RSIインジケーターが過買いを示したとき,ショート

  5. ストップ・ロスは入場価格の4%に設定されます.

  6. 利益を取ることは,バッチで行われます. まず20%の利益を取ります. その後,価格が上昇し続けると15%を取ります. ポジションを徐々に退去します.

利点分析

  1. 異なる期間の3つのSMA線を使用して,異なる時間枠におけるトレンド変化を判断できます.
  2. RSI インディケーターの使用は,過買い/過売り領域の外にポジションを開設することを避けます.
  3. バッチ利益の取得は,保有期間と戦略の平均利益の増加

リスク分析

  1. 3つの移動平均線からの誤った信号の確率
  2. 執行開始時の不完全なバッチ利益のリスク
  3. 価格変動が大きい適正な楽器を選択する必要性

オプティマイゼーションの方向性

  1. 入口と出口を最適化するために移動平均値とRSIの修正パラメータをテストすることができます.
  2. 精度を向上させるためにキャンドルパターンをフィルターなど他の指標を追加することができます
  3. ストップ・ロストを動的に追跡し,リスクをさらに制御できる

概要

この戦略は,移動平均指標と過剰購入/過剰売却指標RSIを組み合わせます.取引機会を判断する際に価格傾向の変化を把握することで,一般的に使用されるトレンド追跡戦略に属します.パラメータテストと追加の補助判断指標を組み込むことで,さらなる最適化と改善された勝利率を達成することができます.


/*backtest
start: 2023-11-13 00:00:00
end: 2023-11-20 00:00:00
period: 1m
basePeriod: 1m
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/
// © syfuslokust

//@version=4
strategy(shorttitle='CoinruleCombinedCryptoStrat',title='CoinruleCombinedCryptoStrat', overlay=true)


// RSI inputs and calculations
lengthRSI = 14
RSI = rsi(close, lengthRSI)
//Normal
oversold = input(30)
overbought =  input(70)
//ALGO
//oversold= input(26)
//overbought= input(80)

//sell pct
SellPct = input(20)
ExitPct = input(15)

//MA inputs and calculations
movingaverage_signal = sma(close, input(9))
movingaverage_fast = sma(close, input(50))
movingaverage_slow = sma(close, input(200))
movingaverage_mid= sma(close, input(100))

//Look Back
inp_lkb = input(12, title='Lookback Long Period')
inp_lkb_2 = input(2, title='Lookback Short Period')
 
perc_change(lkb) =>
    overall_change = ((close[0] - close[lkb]) / close[lkb]) * 100

//Entry 

//MA
bullish = crossover(movingaverage_signal, movingaverage_fast)
//Execute buy
strategy.entry(id="long", long = true, when = (RSI < oversold and movingaverage_fast < movingaverage_mid))

//when = crossover(close, movingaverage_signal) and movingaverage_signal < movingaverage_slow and RSI < oversold)

//Exit

//RSI
Stop_loss= ((input (4))/100)
longStopPrice  = strategy.position_avg_price * (1 - Stop_loss)
//MA
bearish = crossunder(movingaverage_signal, movingaverage_fast)
//Execute sell
strategy.close("long", qty_percent = SellPct, when = RSI > overbought and movingaverage_fast > movingaverage_mid)
//when = (crossunder(low, movingaverage_signal) and movingaverage_fast > movingaverage_slow and RSI > overbought) or (movingaverage_signal < movingaverage_fast and crossunder(low, movingaverage_fast)) or (low < longStopPrice))


//PLOT
plot(movingaverage_signal, color=color.black, linewidth=2, title="signal")
plot(movingaverage_fast, color=color.orange, linewidth=2, title="fast")
plot(movingaverage_slow, color=color.purple, linewidth=2, title="slow")
plot(movingaverage_mid, color=color.blue, linewidth=2, title="mid")

もっと