Need help for martingal

 

Please help me for this EA

I want that the martingal willl be applied per pair

Eg: If the gbpusd was lost for the last trade, so the martingal will be applied on gbpusd only once gbpusd will appear

Thanks in advance sir

extern double Lot=0.01; 

extern bool Martingale=true; //martingale

extern double Multiplier=2; //multiplier

int MagicNumber=1234567890;

double last_profit,last_lot;
string last_tip,last_pair;



int start(){



double lot;

if( TotalOrdersCount()==0 ) {

//martingale

if(Martingale=true){

if(last_profit>=0){

lot=Lot;}

if(last_profit<0){

lot=Lot*Multiplier;}

}
else if(Martingale=false)
 {

   lot=Lot;

  }

}

}



int TotalOrdersCount()

{

  int result=0;

  for(int i=0;i<OrdersTotal();i++)

  {

     OrderSelect(i,SELECT_BY_POS ,MODE_TRADES);

     if (OrderMagicNumber()==MagicNumber) result++;

   }

  return (result);

}

 

double last_history_profit()

   {

   double cpte_profit = 0; //int Magik_No = -1;

        if( OrderSelect(OrdersHistoryTotal()-1,SELECT_BY_POS,MODE_HISTORY) )    

          {

           if( OrderMagicNumber() == MagicNumber ) {

           last_profit  = OrderProfit();

           last_lot = OrderLots();

           last_tip = OrderType();
           
           last_pair= OrderSymbol();

          } 

       }

  return(1);

 }
 
tabadany19: I want that the martingal willl be applied per pair

Martingale, guaranteed to blow your account eventually. If it's not profitable without, it is definitely not profitable with.
          Martingale vs. Non Martingale (Simplified RoR vs Profit and the Illusions) - MQL5 programming forum 2015.02.11

Why it won't work: Calculate Loss from Lot Pips - MQL5 programming forum 2017.07.11

 
William Roeder:

Martingale, guaranteed to blow your account eventually. If it's not profitable without, it is definitely not profitable with.
          Martingale vs. Non Martingale (Simplified RoR vs Profit and the Illusions) - MQL5 programming forum 2015.02.11

Why it won't work: Calculate Loss from Lot Pips - MQL5 programming forum 2017.07.11

I just want to try something sir :-)

Reason: