where should I put "or" operator in mql4, my EA?

 

I have this MQL4 EA script and I want to add this: if trading lots volume is higher than 5 then reset to 0.01, but I tried a lot and couldn't do it, any help? where should I add it? ?


void exit()
  {
   for(int i=OrdersTotal()-1; i>=0; i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderProfit()<0) //LOSS
              {
               amountloss=amountloss+OrderProfit();
               TotalLotLoss=TotalLotLoss+OrderLots();
               lot=lots;
               wincount=0;
              }
            else  //profit
              {
               if(wincount==0)
                 {
                  TotalLotLoss=TotalLotLoss+OrderLots();
                  amountloss=amountloss+OrderProfit();
                  lot=TotalLotLoss*multi;
                  wincount=1;
                 }
               else
                 {
                  TotalLotLoss=TotalLotLoss+OrderLots();
                  amountloss=amountloss+OrderProfit();
                  wincount++;
                  if((wincount==2
                    {
                     TotalLotLoss=0;
                     amountloss=0;
                     wincount=0;
                     lot=lots;
                    }
                  else
                    {
                     lot=OrderLots();
                    }

                 }


              }

           }
         if(OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),3,clrNONE)!=true)//if it did not close
           {
            Print("LastError = ",GetLastError());//get the reason why it didn't close
           }
        }
     }
  }
 

Forum on trading, automated trading systems and testing trading strategies


When you post code please use the CODE button (Alt-S)!

Use the CODE button

 
Sergey Golubev:
Sure Sergey, I'm new here, Sorry.
 
zahraa20: but I tried a lot and couldn't do it,

I doubt you; Show us your attempt (using the CODE button) and state the nature of your problem.
          No free help 2017.04.21

Reason: