Kingii91

Need help incorporating Volatility Stop into my strategy

This current strategy is just using a momentum indicator. I plan on researching cryptocurrencies and looking for ones with big upcoming news then using an RSI to spot a breakout and jump in to ride it up to the moon.

I am currently trying to incorporate the volatility stop into this strategy but I'm not really sure how to go about it. I basically just want the strategy to give me a sell signal when the RSI crosses the 30 and the candle closes below the volatility stop level. Any help on amalgamating these 2 strategies would be greatly appreciated

My two strategies are below:

RSI
//@version=3
strategy("RSI momentum Strategy", overlay=true)
length = input( 2 )
overSold = input( 30 )
overBought = input( 70 )
price = close

vrsi = rsi(price, length)

if (not na(vrsi))
if (crossover(vrsi, overBought))
strategy.entry("RsiLE", strategy.long, comment="RsiLE")
if (crossunder(vrsi, overSold))
strategy.entry("RsiSE", strategy.short, comment="RsiSE")

//plot(strategy.equity, title="equity", color=red, linewidth=2, style=areabr)

VOLSTOP
//@version=3
study("Volatility Stop Custom", shorttitle="VStop", overlay=true)

length = input(20)
mult = input(2)
atr_ = atr(length)

max1=0.0
min1=0.0
is_uptrend_prev = false
stop=0.0
vstop_prev=0.0
vstop1=0.0
is_uptrend=false
is_trend_changed=false
max_ = 0.0
min_ = 0.0
vstop=0.0

max1 := max(nz(max_), close)
min1 := min(nz(min_), close)


is_uptrend_prev := nz(is_uptrend, true)

stop := is_uptrend_prev ? max1 - mult * atr_ : min1 + mult * atr_
vstop_prev := nz(vstop)
vstop1 := is_uptrend_prev ? max(vstop_prev, stop) : min(vstop_prev, stop)
is_uptrend := close - vstop1 >= 0
is_trend_changed := is_uptrend != is_uptrend_prev
max_ := is_trend_changed ? close : max1
min_ := is_trend_changed ? close : min1
vstop := is_trend_changed ? is_uptrend ? max_ - mult * atr_ : min_ + mult * atr_ : vstop1
plot(vstop, color = is_uptrend ? green : red, style=cross, linewidth=2)
オープンソーススクリプト

TradingViewの精神に則り、このスクリプトの作者は、トレーダーが理解し検証できるようにオープンソースで公開しています。作者に敬意を表します!無料で使用することができますが、このコードを投稿で再利用するには、ハウスルールに準拠する必要があります。 お気に入りに登録してチャート上でご利用頂けます。

免責事項

これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。

チャートでこのスクリプトを利用したいですか?