xmd79

Pine Editor Tutorial #3 - Trading Sessions

Oct 13th, 2021
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. //@version=4
  2. study("Pine Editor Tutorial #3 - Trading Sessions", overlay=true)
  3.  
  4. // Asking for an input to turn on or off the Exchange Sessions
  5. Sessions = input(false, title="Toggle Coloured Exchange Sessions")
  6.  
  7.  
  8. // Defining the variable Time in range
  9. timeinrange(res, sess) =>
  10. time(res, sess) != 0
  11.  
  12. //plotting according to session
  13.  
  14. timeinrange__1 = timeinrange(timeframe.period, "1900-0300")
  15. bgcolor(Sessions ? timeinrange__1 ? color.red : na : na, transp=70, title="Asian Session")
  16. timeinrange__2 = timeinrange(timeframe.period, "0300-0800")
  17. bgcolor(Sessions ? timeinrange__2 ? color.lime : na : na, transp=70, title="Europe Session")
  18. timeinrange__3 = timeinrange(timeframe.period, "0800-1900")
  19. bgcolor(Sessions ? timeinrange__3 ? color.blue : na : na, transp=70, title="NY Session")
  20.  
  21.  
  22. // The end
  23. // Written by Duncan Oosthuizen
  24.  
Advertisement
Add Comment
Please, Sign In to add comment