I did check both logs and saw Reason 3 and Reason 5....
Here is what I tried with a similar script:
//--------------------------------------------------------------------7 --
if (ticket_1 >0 && ticket_2 >0 && ticket_3 >0 ) // Got it!:)
{
Alert ("Opened All 3 orders ");
break; // Exit cycle
}
//--------------------------------------------------------------------8 --
int Error=GetLastError(); // Failed
switch(Error) // Overcomable errors
{
case 135:Alert("The price has changed. Retrying..");
RefreshRates(); // Update data
continue; // At the next iteration
case 136:Alert("No prices. Waiting for a new tick..");
while(RefreshRates()==false) // Up to a new tick
Sleep(1); // Cycle delay
continue; // At the next iteration
case 146:Alert("Trading subsystem is busy. Retrying..");
Sleep(500); // Simple solution
RefreshRates(); // Update data
continue; // At the next iteration
}
switch(Error) // Critical errors
{
case 2 : Alert("Common error.");
break; // Exit 'switch'
case 5 : Alert("Outdated version of the client terminal.");
break; // Exit 'switch'
case 64: Alert("The account is blocked.");
break; // Exit 'switch'
case 133:Alert("Trading forbidden");
break; // Exit 'switch'
default: Alert("Occurred error ",Error);// Other alternatives
}
break; // Exit cycle
}
How do you suggest I use the Magic Number?