//@version=5 strategy("ChannelBreakOutStrategy" , overlay=true , process_orders_on_close = true) length = input.int(title="Length", minval=1, maxval=1000, defval=5) upBound = ta.highest(high, length) downBound = ta.lowest(low, length) InSession(sessionTimes, sessionTimeZone=syminfo.timezone) => not na(time(timeframe.period , sessionTimes , sessionTimeZone)) timeZone = input.string("GMT-5", title='Time Zone',group='Session') sessionInput = input.session("0800-1300", title="Trading Session",group='Session') daysInput = input.string("1234567", title="Trading Days", group="Session", tooltip="Specifies on which day of\nthe week the session is active. " + "\nThe session has to be active\non at least one day." + "\n\nPossible values and days are:\n1 - Sunday\n2 - Monday" + "\n3 - Tuesday\n4 - Wednesday\n5 - Thursday\n6 - Friday\n7 - Saturday") tradingSession = sessionInput + ":" + daysInput trading_session_filter = InSession(tradingSession, timeZone) cond = not trading_session_filter and trading_session_filter[1] if (not na(close[length])) and trading_session_filter strategy.entry("ChBrkLE", strategy.long, stop=upBound + syminfo.mintick, comment="ChBrkLE") if trading_session_filter strategy.entry("ChBrkSE", strategy.short, stop=downBound - syminfo.mintick, comment="ChBrkSE") if trading_session_filter != trading_session_filter[1] and not trading_session_filter strategy.cancel_all() strategy.close_all(comment="End Of Session")