Watch how to download trading robots for free
Find us on Facebook!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Libraries

MT4 to MT5 Convertor (MT5Compat.mqh) - library for MetaTrader 5

OrderManagement is by @fxSaber https://www.mql5.com/en/users/fxsaber
Published by:
Amirhossein Ghasemi Moroodi
Views:
5311
Rating:
(6)
Published:
2024.11.16 15:47
Updated:
2025.01.29 14:44
MQL5 Freelance Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

📢 MT5Compat a Comprehensive MT4 to MT5 Conversion Library 🚀

A new interface library has been developed to simplify the process of converting MT4 indicators and Expert Advisors (EAs) to MT5. This library supports most of the MetaTrader 4 functions, offering developers a unified solution for cross-platform compatibility.

You can add this to both 


🌟 Key Features:

 Extensive MT4 Function Support: Seamlessly integrates widely-used MT4 functions into MT5 projects. (Order part created by @fxSaber)
 Customizable: Developers can expand the library by adding additional functions as required.
 Unified Codebase: Enables writing a single codebase that works flawlessly for both MT4 and MT5.
 Flexible Integration Options: The library can be included as a  .mqh  file or directly integrated into an EA or indicator.


🛠️ How It Works:

1️⃣ Integrate your MT4 EA or indicator code with the provided library functions.
2️⃣ Use the  .mqh  file to incorporate the library into your project.
3️⃣ Write your logic once and achieve full compatibility with both MT4 and MT5.
4️⃣ You need to replace these functions with the compat version in order to be compatible with both platform with same code


MT4 Function Cross-Compatible Replacement Description
Ask GetAsk() Retrieves the current Ask price for a symbol.
Bid GetBid() Retrieves the current Bid price for a symbol.
MarketInfo(symbol, MODE_DIGITS) GetSymbolDigits(symbol) Gets the number of decimal places for a symbol.
MarketInfo(symbol, MODE_TICKSIZE) GetSymbolTickSize(symbol) Retrieves the tick size for a symbol.
MarketInfo(symbol, MODE_TICKVALUE) GetSymbolTickValue(symbol) Retrieves the tick value for a symbol.
MarketInfo(symbol, MODE_MINLOT) GetSymbolMinLot(symbol) Gets the minimum lot size for a symbol.
MarketInfo(symbol, MODE_MAXLOT)   GetSymbolMaxLot(symbol)   Gets the maximum lot size for a symbol.
MarketInfo(symbol, MODE_POINT) GetSymbolPoint(symbol) Retrieves the point size for a symbol.
MarketInfo(symbol, MODE_SPREAD) GetSymbolSpread(symbol) Gets the spread for a symbol.
Close[x] iClose(symbol, PERIOD_CURRENT, x) Retrieves the close price of the bar at index x .
Open[x] iOpen(symbol, PERIOD_CURRENT, x) Retrieves the open price of the bar at index x .
Low[x] iLow(symbol, PERIOD_CURRENT, x) Retrieves the low price of the bar at index x .
High[x] iHigh(symbol, PERIOD_CURRENT, x) Retrieves the high price of the bar at index x .

🌐 Why This Library?

This interface library is a powerful tool for developers looking to:

  • Save time and resources by maintaining a single codebase.
  • Transition existing MT4 products to MT5 with minimal effort.
  • Customize and expand functionality for advanced solutions.

📂 Availability

The library is now available for integration into your projects.

For inquiries or feedback, feel free to contribute to the discussion below. Let’s make development faster, simpler, and more efficient for everyone!


Empowering developers for cross-platform trading solutions. 🌟


SUPERMACBOT SUPERMACBOT

The SUPERMACBOT is a fully automated trading robot that combines the power of the Moving Average Crossover strategy with the MACD Indicator to deliver precise and reliable trade signals. This Expert Advisor is designed to work seamlessly on all symbols and timeframes, offering versatility and adaptability for traders across various market conditions.

Comment Comment

A simple replacement for a comment. Works in the tester 50 times faster than the standard function.

Get min margin in to csv Get min margin in to csv

The script MinMargins.mq5 is designed to help traders quickly calculate and document the minimum amount of money required to open a position with the smallest lot size for all symbols available in the Market Watch. This data is saved to a CSV file for easy review and analysis.

CloseAgent CloseAgent

Optimal closing tool with Bollinger Bands and RSI.