Advertisement
Guest User

Untitled

a guest
Jan 20th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. //@version=3
  2. study("Support & Resistance", overlay=true)
  3.  
  4. left = 50
  5. right = 25
  6. quick_right = 5 // Used to try and detect a more recent significant swing.
  7.  
  8. pivot_high = pivothigh(high,left,right)
  9. pivot_lows = pivotlow(low, left,right)
  10.  
  11. quick_pivot_high = pivothigh(high,left,quick_right)
  12. quick_pivot_lows = pivotlow(low, left,quick_right)
  13.  
  14. level1 = valuewhen(quick_pivot_high, high[quick_right], 0)
  15. level2 = valuewhen(quick_pivot_lows, low[quick_right], 0)
  16. level3 = valuewhen(pivot_high, high[right], 0)
  17. level4 = valuewhen(pivot_lows, low[right], 0)
  18. level5 = valuewhen(pivot_high, high[right], 1)
  19. level6 = valuewhen(pivot_lows, low[right], 1)
  20. level7 = valuewhen(pivot_high, high[right], 2)
  21. level8 = valuewhen(pivot_lows, low[right], 2)
  22.  
  23. level1_col = close >= level1 ? green : red
  24. level2_col = close >= level2 ? green : red
  25. level3_col = close >= level3 ? green : red
  26. level4_col = close >= level4 ? green : red
  27. level5_col = close >= level5 ? green : red
  28. level6_col = close >= level6 ? green : red
  29. level7_col = close >= level7 ? green : red
  30. level8_col = close >= level8 ? green : red
  31.  
  32. plot(level1, style=circles, color=level1_col, show_last=1, linewidth=1, trackprice=true)
  33. plot(level2, style=circles, color=level2_col, show_last=1, linewidth=1, trackprice=true)
  34. plot(level3, style=circles, color=level3_col, show_last=1, linewidth=1, trackprice=true)
  35. plot(level4, style=circles, color=level4_col, show_last=1, linewidth=1, trackprice=true)
  36. plot(level5, style=circles, color=level5_col, show_last=1, linewidth=1, trackprice=true)
  37. plot(level6, style=circles, color=level6_col, show_last=1, linewidth=1, trackprice=true)
  38. plot(level7, style=circles, color=level7_col, show_last=1, linewidth=1, trackprice=true)
  39. plot(level8, style=circles, color=level8_col, show_last=1, linewidth=1, trackprice=true)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement