Time Bound Trading Sessions

Time Bound Trading Sessions allows to add time bound conditions to your trading sessions given a date range, a time range and/or days of the week.

This indicator can be very handy if you want to control your trading sessions along those three time boundaries, applying them together and/or separately.

Feel free to reuse this code in your own strategy, and leverage the inSession condition as needed.


+ It allows for date range start and/or end to be set.
+ It allows for session time range to be set.
+ It allows for days of the week to be set.
+ It applies chart background color if we are not within the given time bound session parameters.
+ It includes turn on/off functionality.


Date Range
+ {Start} checkbox: turns on/off start date
+ {Start} date/time
+ {End} checkbox: turns on/off end date
+ {End} date/time

Time Range
+ {Session} checkbox: turns on/off session time range
+ {Session} time range

+ {M} checkbox: turns on/off Mondays
+ {T} checkbox: turns on/off Tuesdays
+ {W} checkbox: turns on/off Wednesdays
+ {T} checkbox: turns on/off Thursdays
+ {F} checkbox: turns on/off Fridays
+ {S} checkbox: turns on/off Saturdays
+ {S} checkbox: turns on/off Sundays

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.


The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?