Do you think this will increase the speed of the EA? Interesting, maybe... Honestly, I've never really thought about the order of setting conditions in IF...)
Well... I'm not talking about a huge increase, but still... until the updated terminal with the new MQL4 is released, all logical conditions are read to the end, even if the first one is false
Everything seems to be correct, it should work. Tried your code in mine - it works with minutes. But only from 14:25 to 14:59, from 15:25 to 15:59 etc.
Thanks for the prompt reply, but - alas, something's not working... The code only works this way, both in the body of the script and in the body of the EA. By time and functionality - everything is fine. Orders are placed by clock only!
int start() { int OpenHH=14,OpenMM=25; bool Trade=true; //---- if (Trade) // Разрешение на торговлю. if (TimeHour(TimeCurrent()) >= OpenHH ) // В назначенный час { OpenOrders();Print("Время пришло ",TimeHour(TimeCurrent()),":",TimeMinute(TimeCurrent())); return(0); } // открыть ордера. //---- return(0); } //+------------------------------------------------------------------+ void OpenOrders(){return(0);}
But as soon as I add minutes ( TimeMinute(TimeCurrent()) >= OpenMM ) - no result.
The EA also refuses to place orders by minutes when using the StrToTime() function.
Even when using another function StrToTime() - if I specify time in whole hours - everything is fine, but as soon as I add minutes - no result. Although, as I wrote in the 1st post, orders close at 23:45 on Fridays without any problems...
bool Trade=true;
string OpenTime = "14:00"; // Вот так работает!!!
string OpenTime = "14:25"; // А вот так - не работает!!!
if ( StrToTime(OpenTime) == TimeCurrent() && Trade )
Even when using another function StrToTime() - if I specify time in whole hours - everything is fine, but as soon as minutes are added - no result. Although, as I wrote in the 1st post, the orders close at 23:45 on Fridays without any problems...
bool Trade=true;
string OpenTime = "14:00"; // Вот так работает!!!
string OpenTime = "14:25"; // А вот так - не работает!!!
if ( StrToTime(OpenTime) == TimeCurrent() && Trade )
Sepulca: How do you test? If, for example, on H1 and at opening prices, it probably won't work.
You see, it's as simple as that... The minutes must be a multiple of TF ...
Now / if ( TimeCurrent() == StrToTime(OpenTime) && Trade ), if OpenTime = 14:25 / will work, but only on TF=M1 and M5 ... The function opening orders needs current quotes but the function closing orders doesn't need them...
I missed this point somehow (because of my inexperience)...
How do you test? If, for example, on H1 and at opening prices, it probably will not work.
Ha ha... And here's a lie...
The problem turned out to be in the OpenOrders() function. I have completely forgotten to remove control of order opening on a breakdown of a candle (bar):
if (Volume[0] > 1) return;
So, on what TF the Expert Advisor was testing, it was opening orders on those minutes...
The problem turned out to be in the OpenOrders() function. I have completely forgotten to remove control of order opening on a breakdown of a candle (bar):
if (Volume[0] > 1) return;
So, on what TF the Expert Advisor was testing, it was opening orders on those minutes...
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Only swap places. Still, Hour()>OpenHH more often than hour and minutes.
Do you think this will increase the speed of the EA? I wonder, maybe... Frankly speaking, I've never thought about order of conditions in IF...)
Do you think this will increase the speed of the EA? Interesting, maybe... Honestly, I've never really thought about the order of setting conditions in IF...)
Everything seems to be correct, it should work. Tried your code in mine - it works with minutes. But only from 14:25 to 14:59, from 15:25 to 15:59 etc.
{
int OpenHH=14,OpenMM=25;
bool Trade=true;
//----
if (Trade) // Разрешение на торговлю.
if (TimeHour(TimeCurrent()) >= OpenHH ) // В назначенный час
{ OpenOrders();Print("Время пришло ",TimeHour(TimeCurrent()),":",TimeMinute(TimeCurrent())); return(0); } // открыть ордера.
//----
return(0);
}
//+------------------------------------------------------------------+
void OpenOrders(){return(0);}
But as soon as I add minutes ( TimeMinute(TimeCurrent()) >= OpenMM ) - no result.
The EA also refuses to place orders by minutes when using the StrToTime() function.
Thanks again... I will keep digging...
Maybe that's better.
Nah... This doesn't work either...
Even when using another function StrToTime() - if I specify time in whole hours - everything is fine, but as soon as I add minutes - no result. Although, as I wrote in the 1st post, orders close at 23:45 on Fridays without any problems...
bool Trade=true;
string OpenTime = "14:00"; // Вот так работает!!!
string OpenTime = "14:25"; // А вот так - не работает!!!
if ( StrToTime(OpenTime) == TimeCurrent() && Trade )
{ OpenOrders();Print("Время пришло ",TimeHour(TimeCurrent()),":",TimeMinute(TimeCurrent())); return(0); }
//----
return(0);
}
//+------------------------------------------------------------------+
void OpenOrders(){return(0);}
Nah... This doesn't work either...
Even when using another function StrToTime() - if I specify time in whole hours - everything is fine, but as soon as minutes are added - no result. Although, as I wrote in the 1st post, the orders close at 23:45 on Fridays without any problems...
bool Trade=true;
string OpenTime = "14:00"; // Вот так работает!!!
string OpenTime = "14:25"; // А вот так - не работает!!!
if ( StrToTime(OpenTime) == TimeCurrent() && Trade )
{ OpenOrders();Print("Время пришло ",TimeHour(TimeCurrent()),":",TimeMinute(TimeCurrent())); return(0); }
//----
return(0);
}
//+------------------------------------------------------------------+
void OpenOrders(){return(0);}
I don't know... This code works for me too....
How do you test it? If, for example, on H1 and at opening prices, it probably won't work.
How do you test? If, for example, on H1 and at opening prices, it probably won't work.
You see, it's as simple as that... The minutes must be a multiple of TF ...
Now / if ( TimeCurrent() == StrToTime(OpenTime) && Trade ), if OpenTime = 14:25 / will work, but only on TF=M1 and M5 ... The function opening orders needs current quotes but the function closing orders doesn't need them...
I missed this point somehow (because of my inexperience)...
Thanks a lot, I have sorted it out...
Sepulca:
How do you test? If, for example, on H1 and at opening prices, it probably will not work.Ha ha... And here's a lie...
The problem turned out to be in the OpenOrders() function. I have completely forgotten to remove control of order opening on a breakdown of a candle (bar):
if (Volume[0] > 1) return;
So, on what TF the Expert Advisor was testing, it was opening orders on those minutes...
Stupid in general, on a hard one...
Thanks...
Ha ha... Here's a lie...
The problem turned out to be in the OpenOrders() function. I have completely forgotten to remove control of order opening on a breakdown of a candle (bar):
if (Volume[0] > 1) return;
So, on what TF the Expert Advisor was testing, it was opening orders on those minutes...
Stupid in general, on a hard one...
Thanks...