I am not sure about your difference, but you have hard coded the contract size, are not taking into account quotes between symbol currencies and account currencies.
I would guess, the terminal function does that and in this case your calculations and the terminal calculations differ by one more operation, introducing the difference you are seeing.
Dominik Christian Egert #:
I am not sure about your difference, but you have hard coded the contract size, are not taking into account quotes between symbol currencies and account currencies.
I would guess, the terminal function does that and in this case your calculations and the terminal calculations differ by one more operation, introducing the difference you are seeing.
Thank you ... I dont understand what do you mean with contract size...I use 100000 which is for FX pairs.... this is just for test...if I have used MarketInfo(_Symbol,MODE_LOTSIZE) the result would be the same
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello! I have one question:
If I calculate margin like this:
it is a little different then this
The results are like this:
2022.04.11 19:18:35.732 test EURUSD,M4: marginterminal=298.9966666666667
2022.04.11 19:18:35.732 test EURUSD,M4: calcmargin=289.9999999999999
Why?