Topic: Questions Swap and commission

When I look at the code generated by the application for MT5, I think there are 2 problems in the calculation of position profit.
Profit = profit + commission + swap
1°) The swap has been forgotten in the calculation
2°) POSITION_COMMISSION is accepted by the compiler but the property will always return 0 at runtime.
The commission must be retrieved with the DEAL_COMMISSION property of the Deal class.
This point has been mentioned several times on the MQL5 website.

https://www.mql5.com/en/forum/331558

Re: Questions Swap and commission

Thank you for mentioning DEAL_COMMISSION, I'll take a look at it.

If you can propose an improvement, please post the code and I'll update the experts.