requesting adivce on :- optimize OP_SELL and OP_BUY by using "Switch" function

 

Hi, i'm trying to optimize the code by using "switch" function, but i can't seem to make it work.

can anyone advice what's went wrong on the coding?


portion of the codes

/////////////////////////////////////////////////////////////////////////////////////////////

int TradeMathod=0;

if("condition to look for open trade")
{
TradeMathod = 1;
{
if (TradeMathod <= 0)
return(0);
}
}


switch(TradeMathod)
{
case 1 : ticket=OrderSend(Symbol(),OP_BUY,lotMM,Ask,3,0,Ask+TakeProfit*Point,"sample",MagicNumber,0,Green);
break;

case 2 : ticket=OrderSend(Symbol(),OP_SELL,lotMM,Bid,3,0,Bid-TakeProfit*Point,"sample",MagicNumber,0,Red);
break;

return(TradeMathod);

}

/////////////////////////////////////////////////////////////////////////////////////////////

Reason: