OrderCalcMargin() always returns true and margin 0 - page 4

 
Dr Matthias Hammelsbeck #:

Thanks for explaining everything so clearly, Matthias.

Your post is very well reasoned and highlights the specific behavior of the MetaQuotes demo netting account, which can be confusing for anyone testing OrderCalcMargin without understanding the internal details.

Just to complement your message, mainly for anyone reading this in the future and wondering, "So what are MetaQuotes demo accounts actually for?" it is worth pointing out that these accounts are intended more as an introduction to the platform and the language, rather than as accurate environments for testing execution, margin behavior, or real broker conditions.

They are useful for getting familiar with the terminal, compiling and running basic scripts, and understanding MQL's structure. However, when it comes to more advanced logic, order management, or realistic trading scenarios like margin calculation and leverage effects, it is usually better to work with demo accounts from real brokers, where the conditions are closer to what you would find in a live environment.

Thanks again for sharing such a detailed analysis. I'm sure it will be helpful to others.