Download MetaTrader 5

How to start an EA at a certain time of day

To add comments, please log in or register
Do you want to order an application? Find out how to obtain the desired result
geribosi
17
geribosi 2008.09.15 20:53 

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

Brian Dee - Random Trader
1759
Brian Dee - Random Trader 2008.09.23 16:36  
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); }
geribosi
17
geribosi 2008.09.24 01:02  
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

To add comments, please log in or register