if ((TradeHour==Hour())&&(TradeMinutes==Minute())&&(TradeSeconds==Seconds()))Will not work if there are no ticks that second - very possible. Try:
datetime now = Timecurrent(); #define HR2400 86400 int tod = now % HR2400, // Time of day. todClose = TradeHour * 3600 + TradeMinutes * 60 + TradeSeconds; if (tod >= todClose) ...
WHRoeder:
Will not work if there are no ticks that second - very possible. Try:
Will not work if there are no ticks that second - very possible. Try:
exactly it works fine, code looks
extern int TradeHour=0; extern int TradeMinutes=0; extern int TradeSeconds=0; int start() { if ((TradeHour==Hour())&&(TradeMinutes==Minute())&&(TradeSeconds==Seconds())) Executor(); } int Executor() { OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Bid-StopLoss*Point,Bid+TakeProfit*Point,"SEMI-AUTO",0,0,CLR_NONE); }i want to repeat section from int start() but i have no idea
FilipZ:
WHRoeder:
Will not work if there are no ticks that second - very possible. Try:
Will not work if there are no ticks that second - very possible. Try:
exactly it works fine, code looks
i want to repeat section from int start() but i have no ideaHi FilipZ,
What WHRoeder meant was "it's very possible that there are no ticks at that second", so you will miss that second. That's why WHRoeder's code there is calculating in seconds and using >= (bigger than) sign.
And to close you need to read this from RaptorUK's https://www.mql5.com/en/forum/139654
//if ((TradeHour==Hour())&&(TradeMinutes==Minute())&&(TradeSeconds==Seconds())) if (TradeHour==Hour()&& TradeMinutes==Minute()) { Executor(); }
:D
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
'Alo mates
need just lil help, solution how to close all opened and pending at the end of the day
it shloud be like
but I have another function like this in code
I did try to run second one, on by one, but it does not work, just first is executed
pending I should solve with
there is number to set time expiration, but i have no idea what number i have to write here if I want 24h expiration
thank you for your help