Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=4
- study("Pine Editor Tutorial #3 - Trading Sessions", overlay=true)
- // Asking for an input to turn on or off the Exchange Sessions
- Sessions = input(false, title="Toggle Coloured Exchange Sessions")
- // Defining the variable Time in range
- timeinrange(res, sess) =>
- time(res, sess) != 0
- //plotting according to session
- timeinrange__1 = timeinrange(timeframe.period, "1900-0300")
- bgcolor(Sessions ? timeinrange__1 ? color.red : na : na, transp=70, title="Asian Session")
- timeinrange__2 = timeinrange(timeframe.period, "0300-0800")
- bgcolor(Sessions ? timeinrange__2 ? color.lime : na : na, transp=70, title="Europe Session")
- timeinrange__3 = timeinrange(timeframe.period, "0800-1900")
- bgcolor(Sessions ? timeinrange__3 ? color.blue : na : na, transp=70, title="NY Session")
- // The end
- // Written by Duncan Oosthuizen
Advertisement
Add Comment
Please, Sign In to add comment