Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 249

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
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...