Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2020
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. //@version=4
  2. study("Pivot Points High Low", shorttitle="Pivots HL", overlay=true)
  3.  
  4. lenH = input(title="Length High", type=input.integer, defval=10, minval=1)
  5. lenL = input(title="Length Low", type=input.integer, defval=10, minval=1)
  6.  
  7. fun(src, len, isHigh, _style, _yloc, _color) =>
  8. p = nz(src[len])
  9. isFound = true
  10. for i = 0 to len - 1
  11. if isHigh and src[i] > p
  12. isFound := false
  13.  
  14. if not isHigh and src[i] < p
  15. isFound := false
  16.  
  17. for i = len + 1 to 2 * len
  18. if isHigh and src[i] >= p
  19. isFound := false
  20.  
  21. if not isHigh and src[i] <= p
  22. isFound := false
  23.  
  24. if isFound
  25. label.new(bar_index[len], p, tostring(p), style=_style, yloc=_yloc, color=_color)
  26.  
  27. fun(high, lenH, true, label.style_labeldown, yloc.abovebar, color.lime)
  28. fun(low, lenL, false, label.style_labelup, yloc.belowbar, color.red)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement