Margin Calculation – library MetaTrader 5

Library for calculation of a margin required for opening a position in MetaΠ’rader 5.

The library has 3 functions:

  • Main function: GetMarginForOpening() – directly calculates a margin for opening 1.0 lot by a symbol;
  • Auxiliary function: GetSymbolByCurrencies() – checks for a symbol in the market review;
  • Auxiliary function: GetSymbolPrefix() – returns symbol prefix, if any.

The library is ready to be used. Functions can be copied directly to a code of an expert, an indicator, or a script and used in your code. It can be used just as a library.


πŸ“ˆ ROBOTFX MetaTrader Expert Advisors and Indicators to maximize profits and minimize the risks