Sum of pips for open trades

 
    for(int otsb=OrdersTotal()-1;otsb>=0;otsb--)                      //Check through open orders
      {
     if(OrderSelect(otsb,SELECT_BY_POS,MODE_TRADES)==true)     
     {
       
       if(OrderType()==OP_SELL)                             
      // if(OrderMagicNumber()==magicnumber)
           {
          sell++;                                               //Count the no. open sell trades
             
         double ticket=OrderTicket(); 
         double  pipsare= (OrderOpenPrice()-Bid)/(Point*10);        //Calculate PipValue for each trade       
         double lotsare=OrderLots();                              //Lots
        
      
       if(sell>0)
        {
          double sumx;
          double sumis;
         
      //  for(int mts=0; mts<sell; mts++)
      //  {        
         sumis=pipsare;
         sumx=sumis+pipsare;
         Alert("  Ticket  ",ticket,"  pipsare  ",DoubleToStr(pipsare,2),"  TotalOpen trade Pips   ",DoubleToStr(sumx,2)," Lots  ",lotsare);
        
         
          // }        
          }
         }
        }
       } 
I am trying to " sum " the pips of all/Several open sell trades, To get a running " total " in pips . any assistance to how I can achieve this is appreciated. Thanks
 
barnacle7:
I am trying to " sum " the pips of all/Several open sell trades, To get a running " total " in pips . any assistance to how I can achieve this is appreciated. Thanks

digits jpy currency and eurusd are not same digits

if you trade 0.6 lots or 0.17 lots and both trades are 5oo pips profit what is in that case pipsprofit ??

bid price is only correct if currency is chartsymbol ()

and why do you make double sumx inside your loop and also sumis

is OrderTicket() a double ???? if not why do you make ticket double


Look for iExposure if you want that summing pips

to my opinion sum of pips has no sense a pip eurusd and pip other currency mostly not same value

use SRC button in the right way

also reread the book your coding is awful

 

Replace this

     if(sell>0)
        {
          double sumx;
          double sumis;
         
      //  for(int mts=0; mts<sell; mts++)
      //  {        
         sumis=pipsare;
         sumx=sumis+pipsare;
         Alert("  Ticket  ",ticket,"  pipsare  ",DoubleToStr(pipsare,2),"  TotalOpen trade Pips   ",DoubleToStr(sumx,2)," Lots  ",lotsare);
        
         
          // }        
          }

With this

int TotalPips=TotalPips+pipsare;

Also puting the alert in the for loop might turn out bothersome.

 
tonny:

Replace this

With this

Also puting the alert in the for loop might turn out bothersome.



That's what I was looking for. All working and removed the alert from the loop. Thanks, Tony.
Reason: