Need help for multi currencies coding .

 

I am new of coding , this is good in the backtest to get the lots of buy / sell . but if i use it in demo account ,orders from other currencies will calculate into "dl" and "kl" , so i will have a wrong result , because i want ea to know to put it into individual dl / kl ( as a buy lot/sell lot) 

how can I do it. ? hope someone can help . 

double lotstotals(double &kong){
  double ot=OrdersTotal();
  double dl; double kl; 
  for(int j=0; j<ArraySize(validPairs); j++){
      for(int syn=0; syn<ArraySize(PeriodAry); syn++){
             for(int k=0;k<ot;k++){
                if(OrderSelect(k,SELECT_BY_POS,MODE_TRADES)==true){
                  if(OrderMagicNumber()==MagicNumber){
                      if(OrderSymbol()==validPairs[j]){
                      if(StringFind(OrderComment(),validPairs[j]+" "+getTimeFrame(PeriodAry[syn]),0)!=-1){
                      if(OrderType()==OP_BUY)dl+=OrderLots();
                      if(OrderType()==OP_SELL)kl+=OrderLots();
                   }
                   }
                   }
                   }
                   }

       }

  }  double f=dl;
     kong=kl;
     return(f);

}
 
  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it

  2. Do not trade multiple currencies in one EA
  3. Not a good idea to use comments, brokers can change comments, including complete replacement.
  4. Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 forum
Reason: