finallynitin

RDX score

Jul 19th, 2020
3,337
2
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.46 KB | None | 2 0
  1. study("RDX Score", overlay=true)
  2. len = input(title="length_ADX", type=integer, defval=14)
  3. th = input(title="threshold_ADX", type=integer, defval=14)
  4.  
  5. TrueRange = max(max(high-low, abs(high-nz(close[1]))), abs(low-nz(close[1])))
  6. DirectionalMovementPlus = high-nz(high[1]) > nz(low[1])-low ? max(high-nz(high[1]), 0): 0
  7. DirectionalMovementMinus = nz(low[1])-low > high-nz(high[1]) ? max(nz(low[1])-low, 0): 0
  8.  
  9. SmoothedTrueRange = nz(SmoothedTrueRange[1]) - (nz(SmoothedTrueRange[1])/len) + TrueRange
  10. SmoothedDirectionalMovementPlus = nz(SmoothedDirectionalMovementPlus[1]) - (nz(SmoothedDirectionalMovementPlus[1])/len) + DirectionalMovementPlus
  11. SmoothedDirectionalMovementMinus = nz(SmoothedDirectionalMovementMinus[1]) - (nz(SmoothedDirectionalMovementMinus[1])/len) + DirectionalMovementMinus
  12.  
  13. DIPlus = SmoothedDirectionalMovementPlus / SmoothedTrueRange * 100
  14. DIMinus = SmoothedDirectionalMovementMinus / SmoothedTrueRange * 100
  15. DX = abs(DIPlus-DIMinus) / (DIPlus+DIMinus)*100
  16. ADX = sma(DX, len)
  17.  
  18.  
  19. length_RSI = input(14 )
  20. priceRSI = close
  21. vrsi = rsi(priceRSI, length_RSI)
  22.  
  23. m5 = ADX[1]<ADX and vrsi<30
  24. plotshape(m5, title="SCORE -5", text="-5", textcolor=white, style=shape.labeldown, location=location.abovebar, color=red, transp=0, size=size.tiny)
  25.  
  26. m4 = (ADX[1]>ADX and vrsi<30) or (ADX[1]<ADX and vrsi<35 and vrsi>30)
  27. plotshape(m4, title="SCORE -4", text="-4", textcolor=white, style=shape.labeldown, location=location.abovebar, color=red, transp=0, size=size.tiny)
  28.  
  29. m3 = (ADX[1]>ADX and vrsi<35 and vrsi>30) or (ADX[1]<ADX and vrsi<40 and vrsi>35)
  30. plotshape(m3, title="SCORE -3", text="-3", textcolor=white, style=shape.labeldown, location=location.abovebar, color=red, transp=0, size=size.tiny)
  31.  
  32. m2 = (ADX[1]>ADX and vrsi<40 and vrsi>35) or (ADX[1]<ADX and vrsi<45 and vrsi>40)
  33. plotshape(m2, title="SCORE -2", text="-2", textcolor=white, style=shape.labeldown, location=location.abovebar, color=red, transp=0, size=size.tiny)
  34.  
  35. m1 = ADX[1]>ADX and vrsi<45 and vrsi>40
  36. plotshape(m1, title="SCORE -1", text="-1", textcolor=white, style=shape.labeldown, location=location.abovebar, color=red, transp=0, size=size.tiny)
  37.  
  38. m0 = vrsi<55 and vrsi>45
  39. //plotshape(m0, title="QQE short", text="0", textcolor=black, style=shape.labeldown, location=location.abovebar, color=yellow, transp=0, size=size.tiny)
  40. plotshape(m0, title="QQE long", text="0", textcolor=black, style=shape.labelup, location=location.belowbar, color=yellow, transp=0, size=size.tiny)
  41.  
  42. p1 = ADX[1]>ADX and vrsi>55 and vrsi<60
  43. plotshape(p1, title="SCORE 1", text="1", textcolor=white, style=shape.labelup, location=location.belowbar, color=green, transp=0, size=size.tiny)
  44.  
  45. p2 = (ADX[1]>ADX and vrsi>60 and vrsi<65) or (ADX[1]<ADX and vrsi>55 and vrsi<60)
  46. plotshape(p2, title="SCORE 2", text="2", textcolor=white, style=shape.labelup, location=location.belowbar, color=green, transp=0, size=size.tiny)
  47.  
  48. p3 = (ADX[1]>ADX and vrsi>65 and vrsi<70) or (ADX[1]<ADX and vrsi>60 and vrsi<65)
  49. plotshape(p3, title="SCORE 3", text="3", textcolor=white, style=shape.labelup, location=location.belowbar, color=green, transp=0, size=size.tiny)
  50.  
  51. p4 = (ADX[1]>ADX and vrsi>70) or (ADX[1]<ADX and vrsi>65 and vrsi<70)
  52. plotshape(p4, title="SCORE 4", text="4", textcolor=white, style=shape.labelup, location=location.belowbar, color=green, transp=0, size=size.tiny)
  53.  
  54. p5 = ADX[1]<ADX and vrsi>70
  55. plotshape(p5, title="SCORE 5", text="5", textcolor=white, style=shape.labelup, location=location.belowbar, color=green, transp=0, size=size.tiny)
Add Comment
Please, Sign In to add comment