How to set variables by currency symbol value - what's wrong with this code?

 

Hi all, (I'm a newbie).

I'm trying to set some variable values according to the currency pair being traded at the moment, using the code below. But when I try to compile it, I get the error "EURUSD - more than 1 symbol".

Please what is wrong with my code?

Here it is:

switch(Symbol())
     {
       case 'EURUSD':  
         TakeProfit=50;
         StopLoss=40;
         PipVal=10.0;
         break;
       case 'GBPUSD': 
         TakeProfit=60;
         StopLoss=60;
         PipVal=10.0;
         break;
       case 'USDJPY': 
         TakeProfit=40;
         StopLoss=40;
         PipVal=1000/Bid;
         break;
       case 'USDCHF': 
         TakeProfit=50;
         StopLoss=40;
         PipVal=10/Bid;
         break;
       case 'USDCAD' : 
         TakeProfit=50;
         StopLoss=40;
         PipVal=10/Bid;
         break;
       case 'AUDUSD' : 
         TakeProfit=50;
         StopLoss=40;
         PipVal=10.0;
         break;
       case 'NZDUSD': 
         TakeProfit=50;
         StopLoss=40;
         PipVal=10.0;
         break;
     }

Any help will be really appreciated.

 

If You are newbie, then first closely read documentation please.

1. Single apostroph determines single character literal. See https://docs.mql4.com/basis/types/literal

2. String constants must be enclosed in the quotation marks (double apostrophs). See https://docs.mql4.com/basis/types/string

3. Expression of the switch operator must be of integer type. See https://docs.mql4.com/basis/operators/switch

 

change to

int s = 0;

if (Symbol() = "EURUSD") s=1;

if (.........

switch (s)

{

case 1: ............

break;

case 2: .........

break;

....................

}

Reason: