DomGilberto: I'm actually going through my entire code now and wanted to double check all my loops. I assume this is ok?
It looks OK to me, the only thing you aren't doing that you should iss checking that your OrderSelect() has worked . . . if it hasn't worked your OrderSymbol() call isn't going to return the correct value.
One off topic suggestion . . .
//+----------------------------------------------------------------------------------------------------------------------------------------+ //| Check to see if any order open on this currency pair |//+----------------------------------------------------------------------------------------------------------------------------------------+ int OpenOrdersThisPair(string pair = "") // <----- changed
{
int total=0;
if(pair = "") pair = Symbol(); // <----- addedfor(int i=OrdersTotal()-1; i>=0; i--)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()==pair) total++;
}
return(total);
}
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.
I'm actually going through my entire code now and wanted to double check all my loops. I assume this is ok?
It looks OK to me, the only thing you aren't doing that you should iss checking that your OrderSelect() has worked . . . if it hasn't worked your OrderSymbol() call isn't going to return the correct value.
One off topic suggestion . . .
then your . . .
. . . . can be simplified to . .
. . . when you are using the chart symbol.