Time Format for Buy Sell signals happen after Midnight

Firsttrade=Optimize("Firsttrade",234500,234500,235500,1000); 
Lasttrade=Optimize("LasttradeTime",243500,242500,244500,1000);

Buy = Ref( High , -1 ) > MA(C,10) AND TimeNum()>Firsttrade AND TimeNum()<Lasttrade 

Dear Sirs,

I trade US equities/futures from Asia. Due to time zone diff, I always have buy signals initiated between 1145pm to 1235am (next day). With the above, I can only see buy signals before midnight "000000" and signals happened after midnight thru 1235am will not be shown in the backtest report. I did check the Amibroker manual and websites for resolutions but failed. Please help to shed some light on this. Thanks a lot!!!!!

Regards
KS

hello

On your post i didnot read some were to say that you change the time shift, or what time compression use.

Did you try on database settings window -> intraday settings -> time shift hours?
Can you check the User's Guide please.
https://www.amibroker.com/guide/w_dbsettings.html

1 Like

Don't use AND but use OR. You can not go beyond 23:59:59.999. After midnight you start at zero but not at 24..... And starting zeroes can be removed so it becomes 2500, 3500, 4500 instead of 002500,...,... etc.

Firsttrade=Optimize("Firsttrade",234500,234500,235500,1000); 
Lasttrade=Optimize("LasttradeTime",3500,2500,4500,1000);

tn = TimeNum();
Buy = Ref( High , -1 ) > MA(C,10) AND (tn>Firsttrade OR tn<Lasttrade);
2 Likes

Thanks I tried timeshift and it works!

1 Like