Advertisement
PineCoders

3 last pivots

Oct 25th, 2019
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. //@version=4
  2. study("Lines Test 2", overlay = true)
  3.  
  4. pvtstr = input(3)
  5.  
  6. var line line1 = na
  7. var line line2 = na
  8. var line line3 = na
  9.  
  10. pvthi = pivothigh(high, pvtstr, pvtstr)
  11. plot(pvthi, transp = 100)
  12.  
  13. if barstate.islast
  14. l = 1
  15. for i = 0 to 100
  16. if pvthi[i]
  17. if l == 1
  18. line.delete(line1)
  19. line1 := line.new(bar_index - i - pvtstr, high[i+pvtstr], bar_index, high[i+pvtstr])
  20. else
  21. if l == 2
  22. line.delete(line2)
  23. line2 := line.new(bar_index - i - pvtstr, high[i+pvtstr], bar_index, high[i+pvtstr])
  24. else
  25. if l == 3
  26. line.delete(line3)
  27. line3 := line.new(bar_index - i - pvtstr, high[i+pvtstr], bar_index, high[i+pvtstr])
  28. l := l + 1
  29. if l > 3
  30. break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement