MarketInfo Universal Lib for MQL 5
- librerie
- COSTEL VLAD
- Versione: 1.0
Universal MarketInfo Service Library for MT4 & MT5
Bring simplicity and power to your trading projects with the Universal MarketInfo Service — a professional library that exposes a unified API for both MetaTrader 4 and MetaTrader 5.
No more rewriting code for each platform. With this library, you can:
- Access symbol data, OHLC prices, spreads, and volatility with a single call.
- Query account balance, free margin, stop levels, and lot constraints.
- Work with currency precision, pip values, and normalized volumes.
- Retrieve time data and detect Strategy Tester mode.
Whether you’re building Expert Advisors, indicators, or scripts, this library ensures your code is portable and reliable.
- Write once, run everywhere — MT4 & MT5.
- Save time, reduce errors, and focus on strategy, not boilerplate.
You can download the free source code of this library from github and you can include it directly in your EA code; please note that the source file is compatible with both MT4 and MT5 platforms
Usage Example
// Include the market info API header #import "vladefix/market-info-lib-v1.00.ex5" string GetSymbol(); double GetAskPrice(); double GetBidPrice(); double GetClose(int, ENUM_TIMEFRAMES); double GetOpen(int, ENUM_TIMEFRAMES); double GetHigh(int, ENUM_TIMEFRAMES); double GetLow(int, ENUM_TIMEFRAMES); ... string DoubleToCurrencyString(double); bool IsTestingMode(); void DestroyMarketInfoLib(); #import //------------------------------------------------------- // Initialization function (OnInit) //------------------------------------------------------- int OnInit() { Print("Symbol: ", GetSymbol()); Print("Ask: ", GetAskPrice(), " | Bid: ", GetBidPrice()); Print("Spread: ", GetSpread(), " points"); double lot = NormalizeVolume(0.158); Print("Normalized lot: ", lot); double balance = GetAccountBalance(); Print("Account Balance: ", DoubleToCurrencyString(balance)); if(IsTestingMode()) Print("Running in Strategy Tester..."); } void OnDeinit(const int reason) { DestroyMarketInfoLib() }
