help coding how to calculate totalprofit all posotion >= 10 close;

 
help me please i want to calculate all profit in order and if all position
totalprofit all posotion >= 10 close;
bool   result;
   double price,OrderProfitCash,OrderProfitPoint,RealProfit;
   int    cmd,error;
   int    TradeTick;
   double TimeOut;

   for(TradeTick=OrdersTotal()-1; TradeTick > 0; TradeTick--)
      { TimeOut=0;
        while(!IsTradeAllowed()) {if(TimeOut > 50) break;TimeOut++;}
        if(OrderSelect(TradeTick,SELECT_BY_POS,MODE_TRADES))
           {
           cmd=OrderType();
           //---- first order is buy or sell
           if(cmd==OP_BUY || cmd==OP_SELL)
              {
              while(true)
                 {// Cal the Profit Point
                 RefreshRates();
                 if(cmd==OP_BUY) { price =Bid; OrderProfitPoint =(price-OrderOpenPrice())/Point; }
                 else            { price =Ask; OrderProfitPoint =(OrderOpenPrice()-price)/Point; }
                 
                 OrderProfitCash = OrderProfit()+OrderCommission()+OrderSwap();
                 if(OrderProfitCash <= 0) continue;
                 //if((TakeProfitPoint > OrderProfitPoint) || !OrderProfitCash) break;
                 result=OrderClose(OrderTicket(),OrderLots(),price,GetSlippage(),CLR_NONE);
                 if(result!=TRUE) { error=GetLastError(); Print("LastError = ",error); }
                 else { error=0; Print("OrderProfit = ", OrderProfit());RealProfit+=OrderProfit();}
                 
                 if(error==129 || error==135) RefreshRates();
                 else break;
                 }
              }
           }
           else Print( "Error when order select ", GetLastError());
      }
   Print("Close Profit Order Call, Profit Take =",RealProfit);
   return(0);
   
  }

so hows the coding iam stuck??
 
if you are talking about the whole positions in the account

you can simply use AccountProfit
 
qjol:
if you are talking about the whole positions in the account

you can simply use AccountProfit

from every order sireee