Cannot compile as variable is not defined.....however variable will come from an indicator which will be linked. How can I compile EA that is coded to accept variables from an external indicator? - page 2

 

Well your help was great and indeed && did the trick Dabbler. However, it still will not compile as it has another 2 errors I have marked in bold that I do not understand. Sorry to be a "Numpty" but as you can see I am still a real beginner at this - but I am learning. Here is the code:

int Fun_Error (int Error) // Function of processing errors --'(' - function definition unexpected C:\Users\Cliff Lunt\experts\Cliffs ROC EA (Program Test).mq4 (204, 14)


switch(Error)

{ // Not crucial errors

case 4: Alert("Trade server is busy. Trying once again..");

Sleep(3000); // Simple solution

return(1); // Exit the function

case 135:Alert("Price changed. Trying once again..");

RefreshRates(); // Refresh rates

return(1); // Exit the function

case 136:Alert("No prices. Waiting for a new tick..");

while(RefreshRates()==false) // Till a new tick

Sleep(1); // Pause in the loop

return(1); // Exit the function

case 137:Alert("Broker is busy. Trying once again..");

Sleep(3000); // Simple solution

return(1); // Exit the function

case 146:Alert("Trading subsystem is busy. Trying once again..");

Sleep(500); // Simple solution

return(1); // Exit the function

// Critical errors

case 2: Alert("Common error.");

return(0); // Exit the function

case 5: Alert("Old terminal version.");

Work=false; // Terminate operation

return(0); // Exit the function

case 64: Alert("Account blocked.");

Work=false; // Terminate operation

return(0); // Exit the function

case 133:Alert("Trading forbidden.");

return(0); // Exit the function

case 134:Alert("Not enough money to execute operation.");

return(0); // Exit the function

default: Alert("Error occurred: ",Error); // Other variants -- 'Error' - variable not defined C:\Users\Cliff Lunt\experts\Cliffs ROC EA (Program Test).mq4 (237, 40)


return(0); // Exit the function

}

 

Please use this to post code . . . it makes it easier to read.

 
Code within a function has to be contained within braces { } same as code in a switch statement, has to be in braces { } You don't have an opening brace after your function definition.
Reason: