I have multi time frame strategies where I use 15 min and daily bars.
I want to restrict trading hours to US RTH and get a daily chart in backtesting, however my main time frame is 15 min when trades are executed. I developed and debugged this strategy successfully. My time frame with index 0 is Daily (I need it to get daily charts), my time frame with index 1 is 15 min.
First problem is that there is no session template for daily back testing. Why? It is very inconvinient - 'll have to restrict time programmatically.
So added following restriction in the OnBarUpdate():
//Check if within US RTH
if (!(ToTime(Time[0]) >= USRTH.StartTime && ToTime(Time[0]) <= USRTH.EndTime))
return;
Now it works as expected entering trades within RTH. But when I look at trades in backtesting they have exit time at 4:00 AM. Why?
Separate issue: Why when I have 15 min chart in backtesting I can't scale it up to daily? Because that would allow me to use minutes time frame and set session to RTH and then it would work properly - I checked, trades have correct time.
Thanks.
Comment