OrderProfit() Need Help Seperating OP_BUY from OP_SELL

 
I have an EA that places buys and sells both, sometimes both types will exist together at the same time.
Instead of manually counting both profits, I am trying to post a comment that shows each individual totals.

Here is sample code I am using. I know it's not right, so maybe someone could assist?
Thank you in advance.

OpenBuyProfit = 0;                  

            total = OrdersTotal();
            
            for(i=0;i<total;i++)
                                           
              {
              OrderSelect(i, SELECT_BY_POS );
              if ( OrderSymbol() == Symbol() && OrderMagicNumber() == forMagic && type == OP_BUY)  
                {
                  OpenBuyProfit = OpenBuyProfit + OrderProfit();
                   
                  }
              }

 
OpenBuyProfit+=OrderProfit()+OrderSwap()+OrderCommission();
 
Slawa thanks for replying. I have tried to change but still get value of 0

OrderSelect(i, SELECT_BY_POS );
              if ( OrderSymbol() == Symbol() && OrderMagicNumber() == forMagic && type == OP_BUY)  
                {
                  OpenBuyProfit += OrderProfit()+OrderSwap()+OrderCommission(); 
 
Try to print selected orders
Reason: