移動平均と相対力指数に基づくモメンタム反転戦略


作成日: 2024-01-03 17:14:15 最終変更日: 2024-01-03 17:14:15
コピー: 10 クリック数: 547
1
フォロー
1621
フォロワー

移動平均と相対力指数に基づくモメンタム反転戦略

概要

この戦略は,移動平均と相対的に強い指標に基づいた動量逆転戦略である.これは,快移動平均と遅移動平均の交差,および超買い超売りシグナルを使用して,EntryとExitを判断する.

戦略原則

この戦略は,14日移動平均を高速信号線として,28日移動平均を遅い信号線として使用する.また,RSI指標と組み合わせて,市場が過買過売であるかどうかを判断する.

14日移動平均線上を通過28日移動平均線とRSIが30以下またはRSIが13以下であるとき,判断は逆転し,多入場する.14日移動平均線下を通過28日移動平均線を穿過するときは,判断量逆転は失効し,部分停止出場する.

さらに,戦略は,部分停止の仕組みを設定している. 持仓収益が設定された停止点 (デフォルト8%) に達すると,部分停止 (デフォルトで50%を販売する) が設定されている.

優位分析

この戦略は,移動平均の優位性を組み合わせて,ウィップソーによる損失を回避する.

  1. 移動平均は,このノイズの一部をフィルタリングします.

  2. RSI指数では,超買いと超売りを判断し,超売りを避ける.

  3. 部分停止メカニズムは,利益の一部をロックし,リスクを軽減します.

リスク分析

  1. 双移動平均の交差策は,ウィップソーを生じやすく,その結果,損失をもたらす.この戦略は,RSI指標による補助判断により,ウィップソーの一部をフィルターすることができます.

  2. 部分停止は,より大きなイベントを逃す可能性があります.停止点を調整することでリスクと利益のバランスを取ることができます.

最適化の方向

  1. 異なるパラメータの移動平均の組み合わせをテストし,最適なパラメータを探します.

  2. RSIの異なる値をテストできます.

  3. 部分停止の停止点と販売比率を調整して,リスクと利益のバランスを取ることができる.

要約する

この戦略は,全体として典型的な反転戦略である.これは,市場反転を判断するために,快速平均線の交差を利用し,RSI指標のフィルタリング信号と組み合わせている.同時に,利益の一部をロックするために部分ストップを設定している.この戦略は,シンプルで実用的で,パラメータを調整して異なる市場に適応することができます.

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

//@version=3
strategy(title = "14/28 SMA and RSI", shorttitle = "14/28 SMA and RSI", overlay = false, pyramiding = 0, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, currency = currency.USD)
src = close, len = input(14, minval=1, title="Length")
take_Profit=input(8, title="Take Profit")
quantityPercentage=input(50, title="Percent of Quantity to Sell")
closeOverbought=input(true, title="Close Overbought and Take Profit")
up = rma(max(change(src), 0), len)
down = rma(-min(change(src), 0), len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
longCondition = 0
sellCondition = 0
takeProfit = 0
quantityRemainder = 100
smaSignal = input(14, title="SMA Signal Period")
smaLong = input(28, title="SMA Longer Period")
if ((sma(close, smaSignal) >= sma(close, smaLong) and rsi<= 30) or (rsi<=13)) and strategy.position_size==0
    longCondition:=1

if longCondition==1
    strategy.entry("Buy", strategy.long)
    
profit = ((close-strategy.position_avg_price)/strategy.position_avg_price) * 100

if sma(close, smaSignal) <= sma(close, smaLong) and strategy.position_size>1
    sellCondition := 1

if strategy.position_size>=1
    if closeOverbought == true
        if profit>=take_Profit and takeProfit == 0
            strategy.exit("Take Profit", profit=take_Profit, qty_percent=quantityPercentage)
            takeProfit:=1
            quantityRemainder:=100-quantityPercentage
    if sellCondition == 1 and quantityRemainder<100
        strategy.close("Buy")

    if closeOverbought == false and rsi>70
        strategy.close("Take Profit")
        
plot(longCondition, "Buy Condition", green)
plot(takeProfit, "Partial Sell Condition", orange)
plot(sellCondition, "Sell Condition", red)