Platforms & AutomationMQL4MQL5
MQL (MetaQuotes Language)
The proprietary C-like programming language used to build expert advisors, custom indicators and scripts inside MetaTrader.
What MQL (MetaQuotes Language) means
MQL is the programming language family MetaQuotes created for its terminals. MQL4 powers MetaTrader 4 and has a procedural, C-like syntax; MQL5 powers MetaTrader 5 and is object-oriented, with classes, inheritance and a much larger standard library. Code is written in the bundled MetaEditor, compiled to an executable file that the terminal loads, and can take three forms: an expert advisor that trades, a custom indicator that draws on the chart, or a script that runs once when applied.
The language gives access to price history, symbol properties, account state, indicator values, order and position functions, timers, file input and output, and network requests to permitted addresses. This is enough to build a complete strategy, a risk manager or a data logger, but it is a sandbox rather than a general-purpose environment. The two dialects are not interchangeable: an MQL4 expert advisor will not compile under MQL5, and porting typically means rewriting order-handling code around a different position model.
For a trader who does not code, MQL still matters because it defines what can and cannot be automated on the platform, and because the marketplace of paid MQL products is where most retail automation is bought. Two practical cautions apply. Compiled files distributed without source cannot be inspected, so their real logic and risk controls are unknown. And any program with file or network permissions is running arbitrary code on the same machine as a live trading account.
Worked example
A short MQL script that loops through open positions and moves each stop loss to break-even once a trade is 20 pips in profit is often a trader's first piece of code, well before any full strategy is attempted.
Related terms
- Expert Advisor (EA)An automated trading program written in MQL that runs inside MetaTrader and can place, modify and close orders without human input.
- MetaTrader 4 (MT4)The 2005 MetaQuotes retail terminal built around MQL4 expert advisors, hedging accounts and a single-threaded strategy tester.
- MetaTrader 5 (MT5)MetaQuotes' multi-asset successor to MT4, using MQL5, netting or hedging accounts, more timeframes and a multi-threaded tester.
- Custom IndicatorA user-written or third-party study added to a chart to calculate and display values the platform does not provide natively.
- Algorithmic TradingUsing coded rules rather than discretion to generate signals, size positions and route orders, with the computer executing decisions.
Frequently asked questions
What does MQL (MetaQuotes Language) mean in forex trading?
The proprietary C-like programming language used to build expert advisors, custom indicators and scripts inside MetaTrader.
How does MQL (MetaQuotes Language) work in practice?
The language gives access to price history, symbol properties, account state, indicator values, order and position functions, timers, file input and output, and network requests to permitted addresses. This is enough to build a complete strategy, a risk manager or a data logger, but it is a sandbox rather than a general-purpose environment. The two dialects are not interchangeable: an MQL4 expert advisor will not compile under MQL5, and porting typically means rewriting order-handling code around a different position model.
What is an example of MQL (MetaQuotes Language)?
A short MQL script that loops through open positions and moves each stop loss to break-even once a trade is 20 pips in profit is often a trader's first piece of code, well before any full strategy is attempted.
Trade with a regulated broker
Understanding the terminology is the cheap part. The expensive part is choosing a counterparty whose execution, financing and withdrawal behaviour match what the marketing implies. Every broker below has been reviewed with a funded live account, and each review states which legal entity and which regulator applies to the account you would actually open.
Check the licence on the regulator's own register before you deposit — our regulators directory explains what each authority enforces, from leverage caps to compensation limits.