Install Lorentzian Classification on MetaTrader 5
Install the free open-source indicator, add it to a Windows MT5 chart, and check that the classifier's labels appear. This guide installs an indicator, which does not place orders. The separate Expert Advisor is a different program for testing and automated trading.
Already have MetaTrader 5 installed and connected to an account? Jump to Section 3.
Section 1 - Introduction
By the end of this guide you will have the AI Edge Lorentzian Classification indicator running on a MetaTrader 5 chart.
We will not cover trading strategy or position sizing. We will not cover parameter optimization.
Lorentzian Classification (LC) is a market-state classifier. It compares price-derived features with historical bars using Lorentzian distance, then combines selected neighbors' labels into a directional vote. The output is an indication of market state, not a forecast probability.
Section 2 - Set Up MetaTrader 5
2A. What You Need Before You Start
- A Windows PC running Windows 10 or 11, as listed in MetaQuotes’ current installation requirements
- About 10–15 minutes and a stable internet connection
- An email address for the free mql5.com account you will create in Section 3
No prior trading software or payment information required.
The screenshots show the MQL5 Market version 1.0 and its earlier layout. The official GitHub releases can contain a newer version and use the shorter file name LorentzianClassification. Check the version you installed when comparing settings or reporting a problem.
2B. Download and Install MetaTrader 5
MetaTrader 5 is free. Go to metatrader5.com/en/download and download the Windows installer.

There are two versions of MetaTrader: MT4 and MT5 (current). The LC indicator only works with MT5.
Run the .exe installer and accept the defaults. When it finishes, MT5 launches on its own.
2C. Create a Demo Account and Log In
On first launch, MT5 opens an Open an Account wizard.
You will be asked to select a company to open an account with. Choose MetaQuotes Ltd.

Choose Open a demo account to trade virtual money without risk. A demo account uses virtual funds. It lets you explore the platform without placing trades with real money.

Fill in required information fields. Leave the default values for the bottom half of the form. Click Next and MT5 creates the account and logs you in.
You may have closed it accidentally. Go to File → Open an Account to reopen it. If you already have broker credentials, use File → Login to Trade Account instead.
Section 3 - Download the Indicator from mql5.com
Navigate to the AI Edge Lorentzian Classification Open Source listing on mql5.com.

You need an mql5.com account to download. Sign in or create one if you have not already; the download button will not function without a login.
Before downloading, you also need to log in to your mql5.com account inside the MT5 application. Open MT5 and find the account icon in the top-right. Click it and follow the sign-in instructions. You can also enter the account under Tools → Options → Community, as described in MetaQuotes' Market installation help.
The mql5.com account is separate from the MT5 account you opened in the MT5 application earlier.

Click Download and follow the on-screen instructions. Your browser may ask for permission to open the file in MT5. Click Open to allow it.

When MT5 is running and connected to the marketplace, a notification should appear indicating that the Lorentzian Classification Open Source indicator has been installed.

If no notification appears, check that the intended MT5 installation is open and that its MQL5 account is signed in. Check Market → My Purchases in the Navigator for the download. If the browser handoff still fails, use the official binary route in Section 4.
Section 4 - Add the Indicator to MetaTrader 5 Manually
If you already have the LC indicator installed, you may skip to Section 5.
For a direct file download, open the official AI Edge MQL5 releases. Choose a versioned mql5-v… release and download LorentzianClassification.ex5 from Assets. The rolling mql5-latest prerelease changes as development continues. This chart guide needs the indicator, not LorentzianClassification_EA.ex5.
In MT5, go to File → Open Data Folder.

A Windows Explorer window opens at MetaTrader's data directory. Open the MQL5 folder, then the Indicators folder. This is where all your indicators will live. If the auto-install worked, open the Market folder and you should see the indicator in there.

Copy the downloaded LorentzianClassification.ex5 into the Indicators folder. The image below shows an earlier file name; your official release file uses the name given above. An MQL5 Market download is managed by MT5 and may not create a normal browser download.

Back in MT5, open the Navigator panel (Ctrl + N), expand Indicators, right-click it, and select Refresh.

If the indicator still does not appear, close and reopen MT5. Confirm that you copied the .ex5 file into the data folder opened by this MT5 installation, rather than a different terminal's folder. To build from source instead, use the MQL5 port's installation instructions; the .mq5 source needs its include files and compilation in MetaEditor.
Section 5 - Open a Chart
Right-click any symbol in the Market Watch panel and select Chart Window, or go to File → New Chart.
Start with EURUSD. It is available across brokers and a reasonable reference for a first run.
Set the timeframe to H1 or D1.

Section 6 - Apply the Indicator to the Chart
In the Navigator panel (Ctrl + N), expand Indicators and find Lorentzian Classification Open Source under Indicators/Market for the MQL5 Market install, or LorentzianClassification under Indicators for the official .ex5 release.

Drag it onto the chart or double-click it. The configuration window will open.

Leave the inputs at their defaults for this first check and select OK. For the settings available in this port, use the MQL5 settings reference. The TradingView Premium General Settings guide describes a different feature set and does not cover Feature Count or Color Compression.
The installation is complete when the indicator is listed in the Navigator, opens on the chart, and shows its output once price history is available. If it is listed but draws nothing, check Toolbox → Experts and Journal for the exact error before reinstalling it.
Section 7 - Reading the Indicator Output

Each bar gets a label from the classifier, ranging from -n to +n, where n is the Neighbors Count input (8 by default, so labels run from -8 to +8). To assign it, the algorithm compares the current bar's feature vector with historical bars using Lorentzian distance. Its selected historical neighbors vote on the label.
A bullish label means the cumulative vote from the neighbors was positive (+1 to +n). It is the classifier's directional vote, not evidence that those neighbors preceded an upward move or that the current price will rise.
A bearish label means the vote was negative (-1 to -n).
A cumulative vote of 0 is also possible. This can be read as a neutral label.
A sustained run of positive or negative values shows consistent directional votes among the selected historical neighbors. Frequent sign changes show that the vote changes as the inputs evolve. Neither pattern establishes a stable trend or the probability of a future move.
The on-chart Trade Stats table is a calibration aid for comparing different settings, not a full strategy backtest. It does not establish what a live account would earn. For a separate Strategy Tester workflow, read the official MQL5 port guide.
Remember that the indicator has no knowledge of your broker's spread, your account size, the time of day, or whether a news event is pending. It simply compares market states against historical data.
This port follows the Pine Script® version's algorithm. Compare versions using the same data, settings, history, warmup, and bar alignment; matching the algorithm alone does not establish identical chart output.
Section 8 - Next Steps
If you're a programmer or simply interested in how it all works, the indicator's source code is on GitHub. Clone it, read through the algorithm, and open an issue if you find unexpected behavior on a specific symbol or timeframe.
For questions and discussion, there is a dedicated MetaTrader channel on the AI Edge Discord.
To report a problem, open a GitHub issue. Include the indicator version (shown after its name in the configuration window's title bar), the symbol, timeframe, broker, MT5 build number, and what you observed vs. what you expected.
The indicators, tools, and content provided by AI Edge are for educational and informational purposes only. Nothing here constitutes financial advice or a recommendation to buy or sell any financial instrument. All trading involves risk, and users are solely responsible for their own trading decisions and risk management.