RSI Vパターンに基づく短期利益戦略


作成日: 2024-01-12 13:52:55 最終変更日: 2024-01-12 13:52:55
コピー: 2 クリック数: 735
1
フォロー
1617
フォロワー

RSI Vパターンに基づく短期利益戦略

概要

この戦略は,RSIのV形をベースに,EMA均線フィルターと組み合わせて,より信頼性の高いショートラインの利得戦略を形成する.それは,価格が超売り区域で反発する機会を捕捉し,RSIのV形信号を正確に使って,ショートラインで利得する目的を達成する.

戦略原則

  1. 20日線を50日線の上に長線として多頭とする判断
  2. RSIは反発の機会を示すVの形をとった
    • 前K線の最低値は前2K線の最低値より低い
    • このK線RSIは,前2つのK線RSIよりも高い
  3. RSIは30をV形で完了した信号として使います.
  4. 入札価格の8%以下でストップ・ロスを設定する
  5. RSIが70を超え,入場価格にストップ・ロスが移動
  6. RSIは90からスタート
  7. RSIが10/ストップスレードを突破し,全額を平らにする

優位分析

  1. EMA平均線を使って大トレンドの方向を判断し,逆転操作を避ける
  2. RSI Vの形は,超売り地域反発の機会を判断し,反転傾向を捉える
  3. 多重停止メカニズムによるリスク管理

リスク分析

  1. 株価の下落が止まらなくなり,大きな損失を招く可能性がある
  2. RSI V形シグナルに誤差があり,不必要な損失を招く可能性があります.

最適化の方向

  1. RSIパラメータを最適化して,より信頼性の高いRSI V形状を探す
  2. 逆転信号の信頼性を判断する他の指標と組み合わせる
  3. ストップ・ストップ戦略を最適化し,急進的なストップ・ストップを防止する

要約する

この戦略は,EMA均線フィルターとRSI V形状判断を統合し,より信頼性の高いショートライン操作戦略を形成する.それは,オーバーセール領域の反発の機会を効果的に捉え,ショートラインで利益を上げることができる.この戦略は,パラメータとモデルを継続的に最適化し,ストップメカニズムを完善することにより,安定性と収益性をさらに強化することができます.それは,量化トレーダーに別のショートラインの利益の扉を開きます.

ストラテジーソースコード
/*backtest
start: 2023-12-12 00:00:00
end: 2024-01-11 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/
// © mohanee

//@version=4
//strategy("RSI V Pattern", overlay=true)
strategy(title="RSI V Pattern", overlay=false )

//Strategy Rules
//ema20 is above ema50  --- candles are colored  green on the chart
//RSI value sharply coming up which makes a V shape ,  colored in yellow on the chart
//RSI V pattern should occur from below 30    

len = input(title="RSI Period", minval=1, defval=5)
stopLoss = input(title="Stop Loss %", minval=1, defval=8)

myRsi = rsi(close,len)

longEmaVal=ema(close,50)
shortEmaVal=ema(close,20)

//plot emas 
//plot(longEmaVal, title="Long EMA" ,linewidth=2, color=color.orange, trackprice=true)
//plot(shortEmaVal, title="Short EMA" ,linewidth=2, color=color.green, trackprice=true)


longCondition =  ema(close,20)>ema(close,50)   and (low[1]<low[2] and  low[1]<low[3]) and (myRsi>myRsi[1] and myRsi>myRsi[2] ) and crossover(myRsi,30) //  (   and myRsi<60)  

//(myRsi<60 and myRsi>30)  and myRsi>myRsi[1] and (myRsi[1]<myRsi[2]  or  myRsi[1]<myRsi[3]) and (myRsi[2]<30)  and (myRsi[3]<30 and myRsi[4]>=30)



barcolor(shortEmaVal>longEmaVal?color.green:color.red)
//longCondition = crossover(sma(close, 14), sma(close, 28))
barcolor(longCondition?color.yellow:na)
strategy.entry("RSI_V_LE", strategy.long, when=longCondition )
//stoploss value at 10%
stopLossValue=strategy.position_avg_price -  (strategy.position_avg_price*stopLoss/100) 
//stopLossValue=valuewhen(longCondition,low,3)


//takeprofit at RSI highest  reading
//at RSI75 move the stopLoss to entry price
moveStopLossUp=strategy.position_size>0 and crossunder(myRsi,70)
barcolor(moveStopLossUp?color.blue:na)
stopLossValue:=crossover(myRsi,70) ? strategy.position_avg_price:stopLossValue

//stopLossValue:=moveStopLossUp?strategy.position_avg_price:stopLossValue
rsiPlotColor=longCondition ?color.yellow:color.purple
rsiPlotColor:= moveStopLossUp ?color.blue:rsiPlotColor
plot(myRsi, title="RSI", linewidth=2, color=rsiPlotColor)
//longCondition?color.yellow:#8D1699)
hline(50, title="Middle Line", linestyle=hline.style_dotted)
obLevel = hline(75, title="Overbought", linestyle=hline.style_dotted)
osLevel = hline(25, title="Oversold", linestyle=hline.style_dotted)
fill(obLevel, osLevel, title="Background", color=#9915FF, transp=90)


    
//when RSI crossing down 70 , close 1/2 position and move stop loss to average entry price
strategy.close("RSI_V_LE",  qty=strategy.position_size*1/2, when=strategy.position_size>0 and crossunder(myRsi,70))

//when RSI reaches high reading 90 and crossing down close 3/4 position
strategy.close("RSI_V_LE",  qty=strategy.position_size*3/4, when=strategy.position_size>0 and crossunder(myRsi,90))



//close everything when Rsi goes down below to 10 or stoploss hit  
//just keeping RSI cross below 10 , can work as stop loss , which also keeps you long in the trade ... however sharp declines could  make large loss
//so I combine RSI goes below 10 OR stoploss hit  , whichever comes first - whole posiition closed
longCloseCondition=crossunder(myRsi,10)  or close<stopLossValue
strategy.close("RSI_V_LE", qty=strategy.position_size,when=longCloseCondition )