order_calc_profit: asymmetric USD half-cent results on MT5 build 6300 / Python 5.0.6231
This question is not for forum users.
Can read related threads:
https://www.mql5.com/en/forum/518384
MetaQuotes-Demo XAUUSD — applicable contract and cost settings for October 2-9, 2026
- 2026.10.15
- www.mql5.com
We are validating an existing private, offline XAUUSD research archive from MetaQuotes-Demo...
Could MetaQuotes clarify the rounding/normalization stages used by the MT5 Python order_calc_profit function, or identify the appropriate official technical-reporting channel?
Environment observed: terminal build 6300, MetaTrader5 Python 5.0.6231; DEMO, USD account with 2 currency decimals; XAUUSDm, calculation mode 0, contract size 100, price digits 3, Tick Size 0.001, Tick Value 0.1 USD. All calculations below use 0.01 lot.
These are saved hypothetical calculation results, not trades, fees or balance postings. The mathematical reference applies Decimal ROUND_HALF_UP only to the final signed USD PnL. A broker support statement describes final-step USD rounding with ties away from zero, but its application to this SDK path has not been established.
Eight cases differ from that exact-decimal reference by one cent:
Symmetric controls (same volume/specification):
The binary64 input price differences for 4000 -> 3999.995 and 4000 -> 4000.005 have the same magnitude: 0.0050000000001091393642127513885498046875. Yet the BUY return magnitudes are 0 and 0.01. Across 48 retained controls, exact final Decimal half-up matches 40; simple binary64 arithmetic followed by final half-up matches 42. Thus ordinary input representation error alone has not explained all observations.
Minimal read-only reproduction: the caller supplies a MetaTrader5 module already initialized to a DEMO terminal. No login, order_check or trading request is included. This snippet has not been rerun to collect new samples.
Questions:
1. At what stage are price differences and USD amounts normalized/rounded? Is the trade direction applied before or after monetary rounding? Are the above results expected for this build/API version?
2. What documented version/build scope applies? If intermediate details are not public, can an official technical team inspect these concrete inputs?
3. Is order_calc_profit only a hypothetical estimate that may round differently from actual deal.profit and balance posting? Which final rounding rule applies to actual USD settlement?
I am not asserting a confirmed SDK defect or a settlement defect; no executed deals corresponding to these controls exist. Please distinguish an implementation explanation from an unverified numerical hypothesis.