I want to print how much time is left remaining for a bar to close, so I can open an order just before the bar closes.
Print("Time left: ",PeriodSeconds()-TimeSeconds(Time));
But on the M1 chart "60" prints out for every tick.
On the D1 chart "86400" prints out for every tick.
It should print numbers approaching 0.
Can you please advise?
Bars open on round minutes, so the seconds will always be 0 when you call Time... remember that Time gives you the bar open time.
Try using TimeCurrent() instead.
To add comments, please log in or register