How to make sure that int start() will run at specific computer time.
there's many ways to do that, sample is below, check the documentation please
int start () { while (!IsStopped()) { datetime local = TimeLocal(); if ( (TimeDayOfWeek (local) == 5 && TimeHour (local) == 23 && TimeMinute (local) == 59 && TimeSeconds (local) >= 00 ) || TimeDayOfWeek (local) > 5 ) { // code in action } Sleep (100); //must have sleep if we use tight while loop } return (0); }
That sleep thing, we must have them if we use tight loop, just don't take too long or we may miss a tick while we're sleep :(
I said many ways. You have to code them carefully, since if that code miss minute 59, then the code in action will never get executed. That's why there is TimeDayOfWeek (local) > 5 - just in case.
:)
I am thinking of close all open orders at 23:59:00 on Friday but it may not happen when there is no new tick coming in. I have searched the documetation but did not find anything close.
Please help me. Thanks
I am thinking of close all open orders at 23:59:00 on Friday but it may not happen when there is no new tick coming in. I have searched the documetation but did not find anything close.
Please help me. Thanks