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)
Skript med en öppen källkod

I sann TradingView-anda har författaren publicerat detta skript med öppen källkod så att andra handlare kan förstå och verifiera det. Hatten av för författaren! Du kan använda det gratis men återanvändning av den här koden i en publikation regleras av våra ordningsregler. Du kan ange den som favorit för att använda den i ett diagram.

Frånsägelse av ansvar

Informationen och publikationerna är inte avsedda att vara, och utgör inte heller finansiella, investerings-, handels- eller andra typer av råd eller rekommendationer som tillhandahålls eller stöds av TradingView. Läs mer i Användarvillkoren.

Vill du använda det här skriptet i ett diagram?