In your code you did not factor in Commissions and Swaps — OrderCommission and OrderSwap.
In your code you did not factor in Commissions and Swaps — OrderCommission and OrderSwap.
Fernando, thank you for your reply;
seems like it's ok with very very small difference, thank you so much..
profit+=OrderProfit()+(OrderSwap())+(OrderCommission());
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.)
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.)

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all,
assume that i'm trading in one pair and doing backtest with an ea.. Ea calculating current basket like the code below;
also ea calculating pair profit with codes below;
the question is, after a while, basket value is getting higher than the pair profit (as i said, assume that it's only one pair in the basket, there is no another position at all).. why is this difference occurs.. I thought that may be MT4 backtest also calculates swaps and comissions so how can i add these details to the profit to make it equal to the basket?? if it's happens from a different thing, what is it and how can i fixx it??
adding a screenshot which first line is basket value and the last line is pair profit.. There is almost 22$ difference..
Thanx in advance..