xmd79

Vet Session Ranges

Nov 17th, 2021
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. //@version=4
  2. //
  3. // Modified from @Lothalin's OM Session Ranges script
  4. //
  5. // This version displays tickers that use the Central Timezon, such as VIX
  6. study("Vet Session Ranges", overlay=true)
  7.  
  8. central = (syminfo.timezone == "America/Chicago")
  9.  
  10. timeIsAllowedMorn = time(timeframe.period,(central ? "0830-0905:23456":"0930-1005:23456"))
  11. var hiMorn = 10e-10
  12. var loMorn = 10e10
  13. if timeIsAllowedMorn
  14. if not timeIsAllowedMorn[1]
  15. hiMorn := high
  16. loMorn := low
  17. else
  18. hiMorn := max(high, hiMorn)
  19. loMorn := min(low, loMorn)
  20.  
  21.  
  22. timeIsAllowedAft = time(timeframe.period,(central ? "1230-1305:23456":"1330-1405:23456"))
  23. var hiAft = 10e-10
  24. var loAft = 10e10
  25. if timeIsAllowedAft
  26. if not timeIsAllowedAft[1]
  27. hiAft := high
  28. loAft := low
  29. else
  30. hiAft := max(high, hiAft)
  31. loAft := min(low, loAft)
  32.  
  33.  
  34. plot(not(true and not time(timeframe.period,(central ? "0830-1230:23456":"0930-1330:23456")))? hiMorn : na, "Morning High", color.rgb(0,255,0,0), 2, plot.style_circles)
  35. plot(not(true and not time(timeframe.period,(central ? "0830-1230:23456":"0930-1330:23456")))? loMorn : na, "Morning Low", color.rgb(255,0,0,0), 2, plot.style_circles)
  36. plot(not(true and not time(timeframe.period,(central ? "1230-1500:23456":"1330-1600:23456")))? hiAft : na, "Afternoon High", color.rgb(0,255,0,0), 2, plot.style_circles)
  37. plot(not(true and not time(timeframe.period,(central ? "1230-1500:23456":"1330-1600:23456")))? loAft : na, "Afternoon Low", color.rgb(255,0,0,0), 2, plot.style_circles)
  38.  
  39.  
Advertisement
Add Comment
Please, Sign In to add comment