MQL4 vs MQL5 – Key Differences Between MQL4 and MQL5 MetaTrader Programming Languages

Have you been wondering about which are the best forex trading platforms?

The trading software industry is under the MetaQuotes Corporation’s heavy domination. Though MetaTrader 4 is indeed regarded as being the primary choice of those who are regarded as professional traders, the truth is that other options do exist for traders, which have been created in the past few years.

MQL4 Similarities

MQL4 is more similar to C++ due to its syntax and procedural programming paradigm. It was designed to allow traders to write scripts, indicators, and automated trading strategies with a structure and coding style that those familiar with C++ would find familiar and more accessible to grasp. MQL4 focuses on simplicity and efficiency for developing trading applications.

MQL5 Similarities

MQL5, while still retaining some similarities to C++, introduces features and concepts from object-oriented programming (OOP), making it closer to both C++ and Java in terms of its syntax and capabilities. MQL5 represents a significant evolution from MQL4, offering advanced functionality for creating complex trading systems. It includes support for the object-oriented programming approach, a more robust standard library, and enhanced debugging tools.

These improvements make it similar to C++ in terms of OOP features and offer constructs and a standard library that could remind developers of Java, especially in how it manages data collections, input/output, and string manipulation.

MQL4 is designed for MetaTrader 4 and focuses on a procedural programming model similar to C++, making it ideal for creating simple trading scripts and indicators. MQL5, developed for MetaTrader 5, advances with features from object-oriented programming and a more prosperous standard library, supporting more complex trading strategies and enhanced performance capabilities.

In my opinion, in 95% of real programming situations, programmers can code excellently in both languages.

Look at this example of Predefined Variables in MQL4 and MQL5:

double AskMqlTick last_tick;
double Ask=last_tick.ask;
int Barsint Bars=Bars(_Symbol,_Period);
double BidMqlTick last_tick;
double Close[]double Close[];
int count;   // number of elements to copy
int Digitsint Digits=_Digits;
double High[]double High[];
int count;   // number of elements to copy
double Low[]double Low[];
int count;   // number of elements to copy
double Open[]double Open[];
int count;   // number of elements to copy
double Pointdouble Point=_Point;
datetime Time[]datetime Time[];
int count;   // number of elements to copy
double Volume[]long Volume[];
int count;   // number of elements to copy

We can see that MQL5 is more complicated than MQL4. MQL4 syntax, in some cases, is better and faster than MQL5.

MetaQuotes PlatformsRegardingo conducting trading on the forex market via the internet, most brokers tend to supply diverse trading platforms. However, the outcome is that most people tend to choose MetaTrader 4. The software was created almost ten years ago. Currently, MetaQuotes Corporation offers two essential trading platform selections, which are considered to be MetaTrader 4 and MetaTrader 5.

See in my video my personal opinion about MT4 vs. MT5:



Metatrader 4 is regarded as an exceptionally crafted platform with forex trading in mind. Because retail forex is quite a novel industry, there was no accessible software by third parties that was reliable until the arrival of MetaTrader 4. This ultra-reliable trading platform allows traders access to many highly beneficial features. They consider that trading is done with just one click, providing more than fifty indicators, access to many advisors who are real experts, limit orders, pending orders, nine varied time frames, and multi-charting.


It cannot be denied that there are some impressive advantages of the usage of MetaTrader 4. Many people choose this platform due to its robust stability. This makes the platform dependable and trustworthy. Moreover, there are some mighty mobile apps. The applications will function for almost all operating systems, such as Windows, Android, and iOS. The mobile versions also provide a high level of stability.

Sometimes, some brokerage firms may present a more comprehensive array of spreads about the MT4 platform than the tighter spreads presented via their primary trading platform, as the brokerage firm grants various trading platforms for traders’ trades. Also, some traders regarded as professionals tend to claim that the platform operates slower than other platforms where they conduct their trades.

Though MetaTrader4 is rather powerful on its merit, it is realized that there is a plugin for this platform that Admiral Markets provides. It is noted as being referred to as the MetaTrader4 Supreme Edition Add-On. This add-on supplies traders with more than fifty extra tools. The plugin dramatically improves the advantages of engaging in the usage of MetaTrader 4. It also provides more comprehensive access to a one-click trading option that is more flexible. It is referred to as the mini-terminal. You will discover the accessibility of new orders, such as OCA orders. Further, you can conduct the dragging and dropping of taking profits and stop losses regarding the trades you have conducted.

mt4 vs. mt5


MetaTrader5 is considered to be somewhat like MetaTrader 4. It is classified as one of the best-performing trading platforms for the forex market at this time. MetaTrader 5 has a faster rate and allows for a wider span of different orders. It also grants the provision of more indicators and also allows access to extra features. While this is a superior platform, it is noted that there are not any significant or revolutionizing elements that can cause MetaTrader4 to experience redundancy. MetaTrader 5 is an impressive selection for brokers and traders because it can manage many more trading elements than MetaTrader 4.

Though MetaTrader 5 is much like MetaTrader 4, the reality is that some diverse advantages regarding the forex market are not part of other trading platforms. MetaTrader 5 empowers the traders to view twenty-one varying timeframes. There are eleven distinctive minute charts, such as the usage of M1, M2, M3, and others. Also, seven varied hourly charts are designated as the H1 hourly chart, the H2 hourly chart, the H3 hourly chart, and others. Also, daily charts, weekly charts, and even monthly charts are used. On the other hand, the majority of trading platforms, including MetaTrader 4, offer the provision of just nine time frames.

MetaTrader5 is an excellent choice for traders; thus, it provides six pending orders. This considers orders categorized as selling stop, buy stop, sell limit, buy limit, sell stop limit, and buy stop limit. MetaTrader 4, along with other platforms for trading on the forex, usually only grants four kinds of pending orders. When you engage in MetaTrader 5, you can switch from the mode for hedging to netting mode. The mode for hedging permits you to access trades in positions opposing each other. This has contributed to the revolution of the options for trading on the forex market. This platform also grants the function for viewing the market’s depth. This permits the traders on the forex to see the bids and the offers set at varied prices regarding the financial instruments.

Here’s what you should know about Metaquotes language MQL4 MQL5

Are you looking for some integrated programming languages to develop trading robots, scripts, technical market indicators, function libraries, etc.? If yes, you can use MetaQuotes Language 4 (MQL4) and MetaQuotes Language (MQL5). These two languages are used in conjunction with the MetaTrader software.

Are you wondering what the primary objectives of these two languages are? Well, they are primarily used to automate trading and operational analysis. Rest assured that an extensive codebase, including source code and library,, backs both languages.

History of Metaquotes language MQL MQL5

MetaTrader platform was developed and released by MetaQuotes Software on July 1, 2005. This platform was meant to perform trading in financial markets. MQL4, an object-oriented programming language, is now designed to work on this platform. At the initial stage, the MQL4 language is used to follow the syntax of C.

Next, MetaTrader 5 was released in 2010, along with the MQL5, a new language. 2014 MetaTrader 4 600 builds were released, bringing significant new language updates. MetaEditor (the development environment) was unified to support MQL4 and MQL5.

MQL4 vs. C++
MQL4 is a different programming language than C++; the advice is to learn this programming language from scratch. However, it will be easy to learn and apply if you have experience with the C++ MQL4 language.

The updated version of MQL4 (600 builds) offers new functions and graphical objects, mainly used to analyze different charts. In addition to it, the protection system was modified entirely to execute EX4 files. Speaking of the similarity between MQL4 (600 builds) and MQL5, the standard library is almost transferred from MQL4 to the updated MQL4 (except the trade subsystem). In addition to it, new data types are also introduced to MQL4. You will also find the micro substitution systems expanded like #ifndef, #ifdef, #endif, and #else. In this way, MQL4 (600 builds) is suitable for for coding other languages like C++ and C. In this bu will even get many classes, object pointers, and structures added. Note that the updated MQL4 offers a strict compiling mode, which further helps you detect and avoid potential programming errors.

Coming to MQL5, this strict compiling mode is automatically available to I t and can’t be disabled. Also, both MQL5 and updated MQL4 support object-oriented programming concepts except the following topics: overload, multiple inheritances, polymorphism, extensibility of types, virtual functions, and encapsulation.

MQL4 vs. MQL5 Compiler

Do you want to know more about the compiler used to compile the above two programming languages? Well, it’s MetaEditor. This compiler will be embedded in the development environment. For example, it’s automatically integrated with MetaTrader 5 and MetaTrader 4 trading terminals. Now, for your quick reference, this compiler allows the convenient editing of the source code, profiling code, developing joint applications remotely in conjunction with other developers, and automatically generating projects by using a template.

Difference between Metaquotes language MQL4 MQL5

You have already revealed the similarities between MQL4 and MQL5 in the above sections. In the below sections, you will mostly find the fundamental difference between them.

The first and foremost difference lies in their trading system setup. For instance, MQL5 should be used to design a positional system. On the contrary, MQL4 should be used to implement trading programs of an order system.

The MetaTrader 5 trading terminal has defined clear delimitations about these two trading programming languages on topics like order, deal, and position. Note that the order is a request that can execute a trading operation. The order can lead to a final trading deal. All aggregate deals of a particular financial instrument are termed as position.

In MQL5, you will find a list of expanded trading functions that can be used on open orders, order history, deal history, and open positions. But, in MQL4, different functions are available to perform the above actions, such as OrderClose(), OrderModify(), OrderSend(), OrderDelete(), and OrderCloseBy(). These functions can open, close, and delete pending orders.

In MQL5, the OrderSend() function is used to carry out all trading operations by sending trade requests. Now, the parameters of this function can vary depending on your trading programs. MQL5 also enables asynchronous trading operations by introducing a new function — OrderSendAsync().

Data types of Metaquotes language MQL4 and MQL5

MQL4 and MQL5 programming languages support various data types that are fundamental for developing trading strategies, indicators, and scripts for the MetaTrader platforms. Here is a detailed look at some of the standard data types available in both languages:

  • Integers:
    • Used to represent whole numbers, both positive and negative.
    • In MQL4 and MQL5, integers are typically used for counting, indexing, and operations that require discrete values.
    • Example data types include int for standard integers and long for larger integer values.
  • Literals:
    • Fixed values that are directly inserted into the code.
    • It can include numeric literals (both integer and floating-point), character literals, and string literals enclosed in quotes.
    • Useful for defining constants, setting parameter values, and initializing variables directly in the code.
  • Boolean/Logical:
    • Represents two possible states: true or false.
    • Used for logical conditions, control flow statements (like if-else structures), and to control the execution flow based on certain conditions being met or not.
  • Floating Point:
    • Represents real numbers (i.e., numbers that can have fractional parts).
    • Essential for calculations requiring precision, such as price data, indicators’ values, and other financial computations.
    • Common floating-point data types include double and float, with double offering higher precision.
  • Strings:
    • They are used to represent sequences of characters, making them crucial for text manipulation, displaying messages, and working with textual data.
    • MQL4 and MQL5 support string operations like concatenation, comparison, and search/manipulation functions.
  • Date and Time:
    • Particular data types for handling date and time values are crucial for timestamping, scheduling tasks, and time-based data analysis.
    • Represented by the datetime type, which can store date and time information, enabling precise tracking of events and indicator values over time.
  • Enumeration:
    • A user-defined data type that consists of integral constants, making code more readable and manageable by replacing numeric codes with meaningful names.
    • Helpful in defining custom sets of related values, such as trading direction (buy/sell), order types, or indicator modes.
  • Color:
    • They are used to specify colors in MetaTrader programs, primarily for visual elements like custom indicator lines, objects, and graphical interface components.
    • Colors can be specified using predefined constants (like clrRed, clrBlue) or custom RGB values.

These data types form the basis of programming in MQL4 and MQL5, allowing developers to create sophisticated and efficient trading tools tailored to the unique demands of financial markets.

Capabilities of MQL4 and MQL5

When comparing the capabilities of MQL4 and MQL5, it’s essential to recognize that both languages are tailored to automate trading and develop custom tools for MetaTrader platforms. However, there are distinct features and enhancements in MQL5 that broaden its application and efficiency. Below are bullet points comparing their capabilities:

Common Capabilities in MQL4 and MQL5:

  • Expert Advisors (EAs):
    • Both allow for the development of EAs for automatic trading, following specified algorithms and parameters.
    • Can react to market changes and perform trading operations based on predefined criteria.
  • Custom Indicators:
    • Both support creating custom indicators to complement existing ones, focusing on analytical tasks without performing trades.
    • Useful for monitoring, reflecting, interpreting market conditions, and assisting in decision-making.
  • Scripts:
    • Scripts in both languages are designed for single execution tasks, such as opening or closing trades, deleting orders, or custom analytical operations.
  • Custom Function Libraries:
    • Both enable the creation of reusable code libraries, allowing for efficient code management and reuse across different projects.

Enhanced Capabilities in MQL5:

  • Advanced Object-Oriented Programming (OOP):
    • MQL5 supports OOP more comprehensively than MQL4, offering enhanced code structuring, reusability, and maintenance.
  • Improved Order Handling:
    • MQL5 introduces a more sophisticated way of managing orders and positions, aligning closer with financial market standards.
  • Event Handling:
    • MQL5 provides a broader set of predefined events, including timer, chart, and custom events, allowing for more interactive and responsive programs.
  • Built-in Support for Multi-Currency and Multi-threaded Testing:
    • MQL5 excels with its ability to test and optimize EAs on multiple currencies simultaneously and utilizes multi-threading for faster backtesting and optimization.
  • Enhanced Graphical Capabilities:
    • MQL5 offers advanced graphical objects and functions, making creating complex user interfaces and graphical displays directly within the trading charts easier.
  • Integrated Development Environment (IDE):
    • While both languages have an IDE, MQL5’s MetaEditor provides superior debugging, profiling, and testing tools, significantly improving the development experience.
  • Higher Execution Speed:
    • MQL5 is generally considered faster than MQL4 due to optimizations in its execution engine, making it more suitable for complex strategies and calculations.




MQL4 vs. MQL5 analysis showed that both languages are as good as tools and easy languages for programming. MQL5 is, in theory, better than MQL4, but most programmers use Metatrader 4 and MQL4 as a based programming language.

The comparative analysis between MQL4 and MQL5 demonstrates that both languages are powerful and user-friendly tools for developing trading programs on their respective MetaTrader platforms. Theoretically, MQL5 offers superior functionality, including advanced programming features and improved performance, making it a more robust choice for developing complex trading strategies and tools.

However, the widespread adoption of MetaTrader 4 in the trading community means that MQL4 remains the preferred programming language for many developers due to its simplicity, wide usage, and extensive base of existing code and resources.



Igor has been a trader since 2007. Currently, Igor works for several prop trading companies. He is an expert in financial niche, long-term trading, and weekly technical levels. The primary field of Igor's research is the application of machine learning in algorithmic trading. Education: Computer Engineering and Ph.D. in machine learning. Igor regularly publishes trading-related videos on the Fxigor Youtube channel. To contact Igor write on:

Trade gold and silver. Visit the broker's page and start trading high liquidity spot metals - the most traded instruments in the world.

Trade Gold & Silver


Recent Posts