Expert Advisors • Indicators • Scripts • Libraries

MQL.RobotFX.org is the biggest collection of MetaTrader expert advisors (MT5 & MT4), indicators, scripts and libraries that can be used to improve trading results, minimize risks or simply automate trading tasks

MetaTrader 5 Libraries | Margin Calculation

MetaTrader Experts, Indicators, Scripts and Libraries

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.

12076

Best MetaTrader Indicators + Profitable Expert Advisors