Download MetaTrader 5

EA won't place pending orders at specified time - page 2

To add comments, please log in or register
Alain Verleyen
Alain Verleyen 2016.04.13 05:59  

Hi Everyone


I now have this part working smoothly, but would like to incorporate something in my EA.  I want the EA to determine the offset between local time (PC time) and Broker (server) time and then either add or subtract that time.  For example, my local time now is one hour behind my Broker time.  Therefore I need to first add 3600 seconds to the time so that Broker time=PC time and then subtract the Minutes_before_news variable(300 seconds) for the trade to open at the correct time.  At the moment I add this manually, but obviously this will change during the year due to DST and from broker to broker.

 I would like the EA to determine whether the time needs to be added or subtracted depending on whether the server timezone is ahead or behind my PC time.  I have come this far, but it won't compile.  Any suggestions, please?  Thank you 


   int serverLocalOffset=(int)MathRound((double)(int(TimeCurrent()-TimeLocal()))/3600)*3600;
trader3000 2016.04.13 14:44  

Thank you very much.
To add comments, please log in or register