How to return profit for buy orders only

 
Hi, I would like my EA to return the profit for all my open buy orders only. Can anyone help me code this, Tanks in advance
 

I got it

double buy_profit = 0;

int cnt=0;

for(cnt=OrdersTotal();cnt>=0;cnt--)

{

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

// if( OrderMagicNumber()==1113 )

{

if(OrderType()==OP_BUY)

{

buy_profit+=OrderProfit() ;

}

}

}

Reason: