# Sum of pips for open trades

Find out how to install MetaTrader on Linux
379
2013.12.13 07:55
```    for(int otsb=OrdersTotal()-1;otsb>=0;otsb--)                      //Check through open orders
{
{

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;

// }
}
}
}
} ```
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
6315
2013.12.13 08:40
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

1020
2013.12.13 09:37

Replace this

```     if(sell>0)
{
double sumx;
double sumis;

//  for(int mts=0; mts<sell; mts++)
//  {
sumis=pipsare;
sumx=sumis+pipsare;

// }
}```

With this

`int TotalPips=TotalPips+pipsare;`

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

379
2013.12.13 14:30
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.