I am writing a simple script to do action at some given time, it reads the current time and sleep for some minutes till the event time happens.
The problem which I am facing is that after the sleep finishes, when I want to read the current bar details (iHigh) it gives me the detail of the bar when the script initiated not the current bar.
for example, if the event will happen at 00:30, and the script initiated at 00:25 it will sleep for 5 minutes and then do the action. but at that time h1 will be the iHigh of the 25 minute bar not the 30.
how to solve this?
this is my code:
I'm not really sure here since I'm rather new to the forums, but the way I see it you're getting the info about the current bar each program Tick.But by using Sleep you don't restart the wait for the next Tick before displaying information, you're displaying it right where you left of. Hence the old information.
Drop in a RefreshRates(); and give it a try...
To add comments, please log in or register