Advertisement
Guest User

Untitled

a guest
Jul 14th, 2018
443
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. //@version=3
  2. //author=[Cyrus c|:D]
  3. study(title="Accumulation/Distribution Percentage (ADP) [Cyrus c|:D]", shorttitle="ADP [c|:D]", precision=0)
  4.  
  5. // inputs
  6. range = input(true, title="Range Bound")
  7. rsif = input(false, title="Show scaled RSI (Works Only in range bound mode)")
  8. len = input(14, minval=1, title="Length")
  9. adpw = input(10.0, minval=0.0, maxval=10.0, title="ADP Weight (at 0 this indicator is identical to RSI scaled from -100 to 100)")
  10. adw = input(0.0, minval=0.0, maxval=10.0, title="A/D Weight (at 10 all volume is included as in MFI)")
  11. pEnable = input(true, title="Factor price (money flow)")
  12. src = input(close, title="Source")
  13.  
  14. // calculations
  15. adr = change(close)/nz(tr(true),0.00000001)
  16. adr := ((1-adw/10)*adr+sign(adr)*adw/10)
  17. sad = adr*volume*(pEnable ? src : 1)
  18. sadma = rma(sad,len)
  19. adp = 100*sadma/rma(abs(sad),len)
  20. rsi_ = 2*(rsi(src,len)-50)
  21. adp_rsi = rsi_*(1-adpw/10)+adp*adpw/10
  22.  
  23. // plot
  24. plot(range ? adp_rsi : sadma, style=line, color=#FF0088FF, title="ADP")
  25. plot(rsif and range ? rsi_ : na, style=line, color=purple, title="RSI")
  26. hline(0, color=#88888888, linestyle=dotted, title = "Neutral")
  27. hline(-40, color=#00ff0088, linestyle=dotted, title = "Oversold")
  28. hline(40, color=#ff000088, linestyle=dotted, title = "Overbought")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement