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. קרא עוד בתנאים וההגבלות.

רוצה להשתמש בסקריפ זה בגרף?