How to start an EA at a certain time of day

 

Hi,

i as wondering if there is a way to have an EA start at a certain time of day usig the terminals internal time or the computers time. Please advise if you are aware of any build in function or snippet of code.

Cheers

ergys

 
E OTTOMH // ===================================================================================== extern int StartHour=5; extern int EndHour=15; init() { } start() { // ================= Do stuff every tick START ================== // Evaluate for Close of open trades // Evaluate for move of Trailing Stops // ================= Do stuff every tick END ================== // ================= Do stuff between limit hours START ================== if(Hour() EndHour) return(0); // Too late // If got here you are in trading window so evaluate for Open // Count current open trades to avoid orders ramping up // If count OK check for Open // ================= Do stuff between limit hours END ================== return (0); }
 
BarrowBoy wrote >>
E OTTOMH // ===================================================================================== extern int StartHour=5; extern int EndHour=15; init() { } start() { // ================= Do stuff every tick START ================== // Evaluate for Close of open trades // Evaluate for move of Trailing Stops // ================= Do stuff every tick END ================== // ================= Do stuff between limit hours START ================== if(Hour() EndHour) return(0); // Too late // If got here you are in trading window so evaluate for Open // Count current open trades to avoid orders ramping up // If count OK check for Open // ================= Do stuff between limit hours END ================== return (0); }

Thanks,

Just one more question when you initialize the start and end hr is thta your system hr or the platform hr. And when you refer to the tick end - would that work on every period os does it have to be the shortest period on the platform? Would that work on every 30 mins?

Thanks in advance,

\r