Just wanted to ask you if inserting the following code at the start of my EA is ok and correct?
// if less than 100 bars on chart then Exit program.
if (Bars<100)
{
Alert("Bars less than 100");
return(0); // exit program.
}
// if trade server is busy then wait 3 minutes.
if (GetLastError()==4)
{
Alert("Trade server is busy. Please wait 3 minutes");
Sleep(180000);
}
// if no connection to server then wait 7 seconds.
if (GetLastError()==6)
{
Alert("No connection to server. Please wait 7 seconds");
Sleep(7000);
}
// If order is locked and under processing then exit program
// and wait for this error number to change to Zero.
// If Error number = 0 then broker has finished processing order.
if (GetLastError()==139)
{
Alert("Order is locked and under processing. Please wait until order has been processed");
return(0);
}
RefreshRates();
..... rest of code here ie order conditions and order actions.
Just wanted to ask you if inserting the following code at the start of my EA is ok and correct?
// if less than 100 bars on chart then Exit program. if (Bars<100) { Alert("Bars less than 100"); return(0); // exit program. } // if trade server is busy then wait 3 minutes. if (GetLastError()==4) { Alert("Trade server is busy. Please wait 3 minutes"); Sleep(180000); } // if no connection to server then wait 7 seconds. if (GetLastError()==6) { Alert("No connection to server. Please wait 7 seconds"); Sleep(7000); } // If order is locked and under processing then exit program // and wait for this error number to change to Zero. // If Error number = 0 then broker has finished processing order. if (GetLastError()==139) { Alert("Order is locked and under processing. Please wait until order has been processed"); return(0); } RefreshRates(); ..... rest of code here ie order conditions and order actions.Thanks in advance.
Kind regards
RJF