Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=3
- //author=[Cyrus c|:D]
- study(title="Accumulation/Distribution Percentage (ADP) [Cyrus c|:D]", shorttitle="ADP [c|:D]", precision=0)
- // inputs
- range = input(true, title="Range Bound")
- rsif = input(false, title="Show scaled RSI (Works Only in range bound mode)")
- len = input(14, minval=1, title="Length")
- 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)")
- adw = input(0.0, minval=0.0, maxval=10.0, title="A/D Weight (at 10 all volume is included as in MFI)")
- pEnable = input(true, title="Factor price (money flow)")
- src = input(close, title="Source")
- // calculations
- adr = change(close)/nz(tr(true),0.00000001)
- adr := ((1-adw/10)*adr+sign(adr)*adw/10)
- sad = adr*volume*(pEnable ? src : 1)
- sadma = rma(sad,len)
- adp = 100*sadma/rma(abs(sad),len)
- rsi_ = 2*(rsi(src,len)-50)
- adp_rsi = rsi_*(1-adpw/10)+adp*adpw/10
- // plot
- plot(range ? adp_rsi : sadma, style=line, color=#FF0088FF, title="ADP")
- plot(rsif and range ? rsi_ : na, style=line, color=purple, title="RSI")
- hline(0, color=#88888888, linestyle=dotted, title = "Neutral")
- hline(-40, color=#00ff0088, linestyle=dotted, title = "Oversold")
- hline(40, color=#ff000088, linestyle=dotted, title = "Overbought")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement