is there a way...

 
I did some searches on various websites with no results.

I am trying to figure out if there is a way in MT4 to return the profit value of a specific pair.

Exactly what the AccountProfit() returns, except only each individual pair's profit.

Thanks
 

loop through OrdersHistoryTotal() filtering by OrderSymbol() and summing up OrderProfit() + OrderSwap() for all applicable trades.

 
1005phillip:

loop through OrdersHistoryTotal() filtering by OrderSymbol() and summing up OrderProfit() + OrderSwap() for all applicable trades.


Im sorry, I explained it wrong.

I am looking for current pair equity.

so lets say i have 4 trades open I want to know when combined if they are in profit or loss.

 
bauerjj10:


Im sorry, I explained it wrong.

I am looking for current pair equity.

so lets say i have 4 trades open I want to know when combined if they are in profit or loss.

Nevermind Figured it out, Thanks

 

Try this: Sums profit/loss values for current open orders.

double ProfitOpenOrders() 
{ 
   double value=0;
   for (int i=0; i<OrdersTotal(); i++) 
      { 
         if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) 
         if((OrderSymbol()==Symbol()) && OrderMagicNumber() == MagicNumber) 
            {
               value+=OrderProfit();
            }
      }  
   return(value); 
}