If the value of OrderCommission() is always positive (which is not for OrderSwap()), then the second equation must be correct always:
double pl = OrderProfit()-OrderCommission()+OrderSwap();
Thanks for providing real examples. Then I think the following equation must always work correctly:
Well, let's cut to the chase... I think the confusion has come from "only seen plus commission [in formula]" being interpreted as "value of OrderCommission() is always positive".
Unless your broker pays you a commission for each trade (if so, please give me your broker's details!) it is going to be a negative number.
In which case just add them all together.
However, if somebody has found a broker anomaly which shows a charged commission as a positive number, then fabs() is one way to deal with it. Whether that causes issues with refunded commissions etc I have no idea.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
In order to calculate the total profit/loss of an open position, which one of the following equations is correct?
double pl = OrderProfit()+OrderCommission()+OrderSwap();
or
double pl = OrderProfit()-OrderCommission()+OrderSwap();