Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //INPUTS//
- length_RVI = 1750
- maTypeInput = "EMA"
- maLengthInput = input.int(35, title="MA Length", group = "DEROZ MOM SHIFT IND")
- bbMultInput = 2
- //CALCULATIONS//
- rviCalculation(src_RVI, length_RVI) =>
- len2 = 14
- stddev = ta.stdev(src_RVI, length_RVI)
- upper_RVI = ta.ema(ta.change(src_RVI) <= 0 ? 0 : stddev, len2)
- lower_RVI = ta.ema(ta.change(src_RVI) > 0 ? 0 : stddev, len2)
- rvi = upper_RVI / (upper_RVI + lower_RVI) * 100
- rvi
- ma(source_RVI, length_RVI, type) =>
- switch type
- "SMA" => ta.sma(source_RVI, length_RVI)
- "Bollinger Bands" =>
- [middleValue, highValue, lowValue] = ta.bb(source_RVI, length_RVI, bbMultInput)
- middleValue // Returning the middle Bollinger Band as the MA
- "EMA" => ta.ema(source_RVI, length_RVI)
- "SMMA (RMA)" => ta.rma(source_RVI, length_RVI)
- "WMA" => ta.wma(source_RVI, length_RVI)
- "VWMA" => ta.vwma(source_RVI, length_RVI)
- requested_rvi = request.security("INDEX:BTCUSD", "D" , rviCalculation(close, length_RVI))
- rviMA = request.security("INDEX:BTCUSD", "D" , ma(requested_rvi, maLengthInput, maTypeInput))
- //TRADE CONDITIONS//
- RVI_LONG = rviMA < 40 and SUPERTREND_X_RSI == 1
- //TEXT MSG//
- var RVI_FILTER = false
- if RVI_LONG
- RVI_FILTER := true
- if rviMA > 43
- RVI_FILTER := false
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- //[ {RSI FILTER DEROZ EDIT} ]////[ {RSI FILTER DEROZ EDIT} ]////[ {RSI FILTER DEROZ EDIT} ]////[ {RSI FILTER DEROZ EDIT} ]////[ {RSI FILTER DEROZ EDIT} ]//
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- //SET VALUES BECAUSE THIS IS A FILTER I USE NOT AN INDICATOR
- //INPUTS//
- lbR = 5
- lbL = 5
- rangeUpper = 60
- rangeLower = 5
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement