I'm now coding a very basic moving average crossover trading system on an hourly chart.
What I'd love to know is how to only open and close trades between 7am and 10pm.
I've used the following code but it still shows trades opening outside these hours (like midnight and 1am in the attached picture - I'll be far into dreamland by then!)
TimeWindow=time(timeframe.period,"0700-2200")
EnterLong = SmallEMA>MedEMA and close>SmallEMA and close>MedEMA and TimeWindow
Can you see if I'm missing anything? (The blue squares in the screenshot are the 7am-10pm trading hours)