I have an indicator that shows my trading setups. I only want to show these during a trading session - perhaps a few hours in the morning. I want the start and end time of the trading session to be configurable. I know I can use a TimeFrame to set this, but I can't figure out how to check is the candlesticks are within this window.
In TradingView, I was able to do something like this:
// InSession() returns 'true' when current bar is inside session time
InSession(sessionTime, sessionTimeZone=syminfo.timezone) =>
not na(time(timeframe.period, sessionTime, sessionTimeZone))
...
// Set input variables for open range time and trading time
tradeHours = input.session("0730-1030", "Trade Session", group = "Sessions")
timeZone = input.string("America/Denver", title = "Time Zone", group = "Sessions")
...
// Set flag for in trading session
tradeSession = InSession(tradeHours, timeZone)
Not sure how to do something equivalent in Motivewave.
Any help/tips greatly appreciated.
In TradingView, I was able to do something like this:
// InSession() returns 'true' when current bar is inside session time
InSession(sessionTime, sessionTimeZone=syminfo.timezone) =>
not na(time(timeframe.period, sessionTime, sessionTimeZone))
...
// Set input variables for open range time and trading time
tradeHours = input.session("0730-1030", "Trade Session", group = "Sessions")
timeZone = input.string("America/Denver", title = "Time Zone", group = "Sessions")
...
// Set flag for in trading session
tradeSession = InSession(tradeHours, timeZone)
Not sure how to do something equivalent in Motivewave.
Any help/tips greatly appreciated.