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)
Skrip open-source

Dalam semangat TradingView, penulis dari skrip ini telah mempublikasikannya ke sumber-terbuka, maka trader dapat mengerti dan memverifikasinya. Semangat untuk penulis! Anda dapat menggunakannya secara gratis, namun penggunaan kembali kode ini dalam publikasi diatur oleh Tata Tertib. Anda dapat memfavoritkannya untuk digunakan pada chart

Pernyataan Penyangkalan

Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.

Inggin menggunakan skrip ini pada chart?