モメンタムプルバック戦略


作成日: 2023-12-12 16:34:52 最終変更日: 2023-12-12 16:34:52
コピー: 0 クリック数: 518
1
フォロー
1219
フォロワー

モメンタムプルバック戦略

概要

モメンタム・プルバック・ストラテジー (Momentum Pullback Strategy) は,RSIの極限値をモメンタム・シグナルとして認識する長短ポジション戦略である.ほとんどのRSI戦略とは異なり,この戦略は極限RSIの読み方の方向で最初のプルバックを検索して入場する.

5日EMA (最低価格) / 5日EMA (最高価格) の最初の引き戻しポイントで多/空を出し,12Kラインの最高点/最低点を平衡する.このローリング高点/低点の仕組みは,価格が長期整理に入ると,ストップターゲットが新しいKラインの出現とともに低下することを意味します.最良の取引は通常2-6Kラインから完了されます.

推奨されるストップダストは,入場価格のX倍ATRである (ユーザ入力パラメータで調整できます).

この戦略は各時間周期と市場の安定性があり,勝率は60~70%で,利益の取引規模は大きい.重要な経済ニュースによる波動の中でシグナルを生成することを避ける必要がある.

戦略原則

  1. 6日RSI値を計算し,90以上 (超買い) と10以下 (超売り) の極限を探します.

  2. RSIがオーバーバイするときは,6K線内から5日EMA (下位線) に引き戻し,オーバーインします.

  3. RSIがオーバーセールしているとき,6K線内で5日EMA (最高線) に戻す空頭入場

  4. 出場戦略は,移動ストップで,長ポジションは過去12K線の最高点を最初の出場目標として,その後新しいKラインが現れたときに新しい12K線の最高点に更新され,ロールアウトを実現する.空頭は,逆に,12K線の最低点をロールして止まる.

  5. ストップダストは入場価格X倍ATRで,カスタマイズ可能です.

優位分析

この戦略は,RSIの極限を動力信号と引き戻しとして組み合わせて,トレンドの潜在的反転点を捉え,勝利率が高い.

モバイル・ストップ・メカニズムが有効で,実際の価格の動きに応じて部分利益をロックし,撤回を減らす.

ATRの止損は,単一損失を効果的に制御する.

強力な安定性,異なる市場とパラメータの組み合わせに適用可能,簡単にリリカルディスクに複製する.

リスク分析

ATR値が大きすぎると,ストップダストが長すぎ,単一損失が拡大する可能性があります.

██整理の場合は,移動停止メカニズムは,利得スペースを縮小します.

引き返しの距離が6K線を超えれば,入場時間を逃す.

大規模な経済事件が発生した場合,取引は滑り落ちたり,偽の突破を起こす可能性があります.

最適化の方向

入学根数を短縮して,例えば6根から4K線に調整して,入学成功率を向上させることができる.

ATRの倍数を増加させ,単発ストップをさらに制御するテストが可能である.

背中を整理する際の損失を回避するために,量能指標を組み合わせることができます.

60分級を突破する中軸の後に入場できるので,部分的な騒音をフィルターできます.

要約する

動量引き戻し戦略は,全体的に非常に実用的なショートライン捕獲戦略である. それは,傾向,反転,止損の複数の側面を組み合わせて,実盤操作を便利にし,また一定のアルファをもっている.パラメータ調整と他の指標を組み合わせて,安定性をさらに向上させることができる.全体的に,この戦略は,量化取引の大きな福音であり,学習し,適用する価値がある.

ストラテジーソースコード
/*backtest
start: 2022-12-05 00:00:00
end: 2023-12-11 00:00:00
period: 1d
basePeriod: 1h
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/
// © Marcns_

//@version=5
strategy("M0PB", commission_value = 0.0004, slippage = 1, initial_capital=30000)
// commision is equal to approx $3.8 per round trip which is accurate for ES1! futures and slippage per trade is conservatively 1 tick in and 1 tick out. 

// *momentum pull back* //

// long / short strategy that identifies extreme readings on the rsi as a *momentum signal*
//Strategy buys/ sells a pullback to the 5ema(low)/ 5ema(high) and exits at rolling 12 bar high/ low. The rolling high/ low feature means that 
//if price enters into a pronlonged consolidation the profit target will begin to reduce with each new bar. The best trades tend to work within 2-6 bars
// hard stop is X atr's from postion average price. This can be adjusted in user inputs.
// built for use on 5 min & 1min intervals on: FX, Indexes, Crypto
// there is a lot of slack left in entries and exits but the overall strategy is fairly robust across timeframes and markets and has between 60%-70% winrate with larger winners.
// signals that occur from economic news volatility are best avoided.  


// define rsi
r = ta.rsi(close,6) 

// find rsi > 90
b = 0.0

if r >= 90
    b := 1.0
else
    na

// find rsi < 10
s = 0.0

if r <= 10
    s := -1.0
else
    na

// plot rsi extreme as painted background color
bgcolor(b ? color.rgb(255, 82, 82, 49): na)
bgcolor(s? color.rgb(76, 175, 79, 51): na)



// exponential moving averages for entries. note that source is high and low (normally close is def input) this creates entry bands
//entry short price using high as a source ta.ema(high,5)
es = ta.ema(high,5)

//entry long price using low as a source ta.ema(low,5)
el = ta.ema(low,5)


// long pullback entry trigger: last period above ema and current low below target ema entry 
let = 0.0

if low[1] > el[1] and low <= el
    let := 1.0
else
    na
//short entry trigger ""
set = 0.0

if high[1] < es[1] and high >= es
    set := -1.0
else
    na

// create signal "trade_l" if RSI > 90 and price pulls back to 5ema(low) within 6 bars
trade_l = 0.0

if ta.barssince(b == 1.0) < 6 and let == 1.0
    trade_l := 1.0
else
    na

plot(trade_l, "l_entry", color.green)

//create short signal "trade_s" if rsi < 10 and prices pullback to 5em(high) wihthin 6 bars
trade_s = 0.0

if ta.barssince(s == -1.0) < 6 and set == -1.0
    trade_s := -1.0
else
    na

plot(trade_s, "s_entry", color.purple)

// define price at time of trade_l signal and input value into trade_p to use for stop parems later
trade_p = strategy.position_avg_price

//indentify previous 12 bar high as part of long exit strat
// this creates a rolling 12 bar high target... a quick move back up will exit at previous swing high but if a consolidation occurs system will exit on a new 12 bar high which may be below prev local high
ph = ta.highest(12)

// inverse of above for short exit strat - previous lowest low of 12 bars as exit (rolling)
pl = ta.lowest(12)


// 1.5 atr stop below entry price (trade_p defined earlier) as part of exit strat
atr_inp = input.float(2.75, "atr stop", minval = 0.1, maxval = 6.0)

atr = ta.atr(10)

stop_l = trade_p - (atr* atr_inp)
stop_s = trade_p + (atr* atr_inp)

//strat entry long

strategy.entry("EL", strategy.long, 2, when = trade_l == 1.0)

//strat entry short

strategy.entry("ES", strategy.short, 2, when = trade_s == -1.0)   
    
//strat long exit

if strategy.position_size == 2
    strategy.exit(id = "ph", from_entry = "EL", qty = 2, limit = ph)
    if strategy.position_size == 2
        strategy.close_all(when = low[1] > stop_l[1] and low <= stop_l)

// strat short exit

if strategy.position_size == -2
    strategy.exit(id = "pl", from_entry = "ES", qty = 2, limit =pl)
    if strategy.position_size == -2
        strategy.close_all(when = high[1] < stop_s[1] and high >= stop_s)




// code below to trail remaining 50% of position //

 //if strategy.position_size == 1 
        //strategy.exit(id ="trail", from_entry = "EL", qty = 1, stop = el)