Advertisement
Guest User

DEnvelope %B [Tradingview Custom Indicator]

a guest
Jul 11th, 2014
8,437
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. //
  2. // @author LazyBear
  3. // List of all my indicators: https://www.tradingview.com/v/4IneGo8h/
  4. //
  5. study("DEnvelope %B [LazyBear]", shorttitle="DENV%B_LB")
  6. lb=input(20, title="DEnvelope lookback length")
  7. de=input(2, title="DEnvelope band deviation")
  8. cutoff=input(3)
  9. alp=2/(lb+1)
  10. src=hlc3
  11. mt=alp*src+(1-alp)*nz(mt[1])
  12. ut=alp*mt+(1-alp)*nz(ut[1])
  13. dt=((2-alp)*mt-ut)/(1-alp)
  14. mt2=alp*abs(src-dt)+(1-alp)*nz(mt2[1])
  15. ut2=alp*mt2+(1-alp)*nz(ut2[1])
  16. dt2=((2-alp)*mt2-ut2)/(1-alp)
  17. but=dt+de*dt2
  18. blt=dt-de*dt2
  19. dbr = but>blt?(src - blt)/(but - blt)%cutoff:0
  20. plot(dbr, color=teal, linewidth=2)
  21. band1 = hline(1, color=gray, linestyle=dashed)
  22. band0 = hline(0, color=gray, linestyle=dashed)
  23. fill(band1, band0, color=teal)
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement