About calculating the profit

 
Hello friends,
As you can see in the picture, I collected 600 points for Buy position in EURUSD currency pair, but it gives me 5.43 rather than 6$.
My code for exiting is:
      if(OrderSelect((int)BuyOrder[x],SELECT_BY_TICKET)==true)
      if(OrderProfit()>=OrderLots()*TakeProfit)
      if(OrderClose(OrderTicket(),OrderLots(),bid[x],Slippage,clrNONE)==true)
While TakeProfit is 600.

What is the problem? I exited with 600 points but it gave me 5.43. Why?
Files:
profit.JPG  45 kb
 
HosseinKOGO:
Hello friends,
As you can see in the picture, I collected 600 points for Buy position in EURUSD currency pair, but it gives me 5.43 rather than 6$.
My code for exiting is:
While TakeProfit is 600.

What is the problem? I exited with 600 points but it gave me 5.43. Why?

Commission, swap.

 
Keith Watford #:

Commission, swap.

Thank you!
One more question: after the order has been closed, if we select the order, Does OrderProfit() include Commission and Swap too? or they are independent from OrderProfit() even after closing?
 
HosseinKOGO #:
Thank you!
One more question: after the order has been closed, if we select the order, Does OrderProfit() include Commission and Swap too?

No.

 

Total Profit is OrderProfit() + OrderSwap() + OrderCommission(). Some brokers don't use the Commission/Swap fields. Instead, they add balance entries. (Maybe related to Government required accounting/tax laws.)
          "balance" orders in account history - Day Trading Techniques - MQL4 programming forum (2017)

Broker History
FXCM Commission - <TICKET>
Rollover - <TICKET>
? >R/O - 1,000 EUR/USD @0.52
? #<ticket>  N/A
OANDA Balance update
Financing (Swap: One entry for all open orders.)
 
Pals, Appreciated!