Advertisement
danucante

Untitled

Nov 14th, 2023
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1.  
  2. //INPUTS//
  3. length_RVI = 1750
  4. maTypeInput = "EMA"
  5. maLengthInput = input.int(35, title="MA Length", group = "DEROZ MOM SHIFT IND")
  6. bbMultInput = 2
  7.  
  8. //CALCULATIONS//
  9. rviCalculation(src_RVI, length_RVI) =>
  10. len2 = 14
  11. stddev = ta.stdev(src_RVI, length_RVI)
  12. upper_RVI = ta.ema(ta.change(src_RVI) <= 0 ? 0 : stddev, len2)
  13. lower_RVI = ta.ema(ta.change(src_RVI) > 0 ? 0 : stddev, len2)
  14. rvi = upper_RVI / (upper_RVI + lower_RVI) * 100
  15. rvi
  16.  
  17.  
  18. ma(source_RVI, length_RVI, type) =>
  19. switch type
  20. "SMA" => ta.sma(source_RVI, length_RVI)
  21. "Bollinger Bands" =>
  22. [middleValue, highValue, lowValue] = ta.bb(source_RVI, length_RVI, bbMultInput)
  23. middleValue // Returning the middle Bollinger Band as the MA
  24. "EMA" => ta.ema(source_RVI, length_RVI)
  25. "SMMA (RMA)" => ta.rma(source_RVI, length_RVI)
  26. "WMA" => ta.wma(source_RVI, length_RVI)
  27. "VWMA" => ta.vwma(source_RVI, length_RVI)
  28.  
  29.  
  30. requested_rvi = request.security("INDEX:BTCUSD", "D" , rviCalculation(close, length_RVI))
  31.  
  32. rviMA = request.security("INDEX:BTCUSD", "D" , ma(requested_rvi, maLengthInput, maTypeInput))
  33.  
  34. //TRADE CONDITIONS//
  35. RVI_LONG = rviMA < 40 and SUPERTREND_X_RSI == 1
  36.  
  37. //TEXT MSG//
  38. var RVI_FILTER = false
  39.  
  40. if RVI_LONG
  41. RVI_FILTER := true
  42.  
  43. if rviMA > 43
  44. RVI_FILTER := false
  45.  
  46.  
  47.  
  48.  
  49.  
  50. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  51. //[ {RSI FILTER DEROZ EDIT} ]////[ {RSI FILTER DEROZ EDIT} ]////[ {RSI FILTER DEROZ EDIT} ]////[ {RSI FILTER DEROZ EDIT} ]////[ {RSI FILTER DEROZ EDIT} ]//
  52. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  53.  
  54. //SET VALUES BECAUSE THIS IS A FILTER I USE NOT AN INDICATOR
  55.  
  56. //INPUTS//
  57. lbR = 5
  58. lbL = 5
  59. rangeUpper = 60
  60. rangeLower = 5
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement