Skip to main content

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​

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.

Screenshot of the download page for MetaTrader 5

MT4 vs MT5

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.

Screenshot of selecting a company to open an account with in the Open an Account wizard

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.

Screenshot of the Open an Account wizard for MetaQuotes Ltd., with "Open a demo account to trade virtual money without risk" selected.

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.

Wizard didn't appear?

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.

Screenshot of the Lorentzian Classification Open Source listing on mql5.com. The breadcrumb reads Market / MetaTrader 5 / Indicators. The left sidebar shows the product thumbnail, a FREE badge, and the Download button; the header shows the vendor, AI Edge LLC, and version 1.0.

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.

Two separate accounts

The mql5.com account is separate from the MT5 account you opened in the MT5 application earlier.

Screenshot of MetaTrader 5 with the MQL5 login panel open on the right. An orange arrow points to the account icon at the right-hand end of the toolbar, which opens the panel. The panel has Create an account and Login tabs, and empty Login and Password fields.

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.

Screenshot of the browser permission dialog headed "This site is trying to open MetaTrader 5 Client Terminal," with the subtext "https://www.mql5.com wants to open this application," a checkbox to always allow mql5.com to open links of this type, and Open and Cancel buttons.

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

Screenshot of MetaTrader 5 with the Market tab open on the Lorentzian Classification Open Source product page, showing the Indicators category, the vendor AI Edge LLC, and version 1.0. Below the product header, a green check and a message underlined in orange read "You have installed 'Lorentzian Classification Open Source'". In the Navigator panel at the lower left, an orange arrow points to the same indicator, now listed under the Market folder.

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.

Screenshot of MetaTrader 5 with the File menu open. The "Open Data Folder" entry, with the keyboard shortcut Ctrl+Shift+D beside it, is outlined in an orange box, and an orange arrow points to it.

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.

Screenshot of a Windows Explorer window with the address bar showing the path MQL5 / Indicators / Market. The folder contains a single item, "Lorentzian Classification Open Source", listed as an MQL5 Program of 68 KB.

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.

Screenshot of a Windows Explorer window with the address bar showing the path MQL5 / Indicators. The folder holds three subfolders — Examples, Free Indicators, and Market — plus the copied file "Lorentzian Classification Open Source", an MQL5 Program of 68 KB, which is selected and highlighted at the bottom of the list.

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

Screenshot of the MetaTrader 5 Navigator panel with the Indicators node right-clicked. The context menu lists New AI Assistant, Buy from the Market, Order your own Program, Create in MetaEditor, Set Hotkey, and Refresh. The Refresh entry at the bottom is outlined in an orange box, and an orange arrow points to it.

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.

Screenshot of MetaTrader 5 showing a clean EURUSD H1 candlestick chart with no indicators applied yet. The Market Watch panel on the left lists symbols and prices, and the Navigator panel below it has the Indicators node expanded, showing the built-in folders — Trend, Oscillators, Volumes, Bill Williams, Market, Examples, Free Indicators — with "Lorentzian Classification Open Source" listed beneath them.


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.

Screenshot of the MetaTrader 5 Navigator panel with the Indicators node expanded, showing the Trend, Oscillators, Volumes, Bill Williams, Market, and Examples folders. The Market folder is expanded and "Lorentzian Classification Open Source" inside it is selected and highlighted, ready to be dragged onto the chart.

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

Screenshot of the Lorentzian Classification Open Source 1.00 configuration window over a EURUSD H1 chart, outlined in orange. The Inputs tab is selected, also outlined in orange, alongside the Common, Colors, and Visualization tabs. The Variable and Value table lists Source set to Close price, Neighbors Count 8, Max Bars Back 2000, Feature Count 5, Color Compression 1, and Show Default Exits, Use Dynamic Exits, and Include Full History all set to false. Load, Save, OK, Cancel, and Reset buttons sit at the edges of the window.

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​

Animation of a EURUSD H1 chart with Lorentzian Classification applied, cycling through six orange callouts that each point to part of the indicator's output. "Bullish label — trending up" points to a cluster of teal 6 and 8 labels above rising candles. "Bearish label — trending down" points to red -8 labels below falling candles. "Neutral label — transition" points to a grey candle where the trend changes direction. "Cumulative neighbor vote, ranging from -n to +n, where n is the number of neighbors considered" points to several of the numeric labels at once. "Entry signal" points to a teal up-triangle below the bars, and "exit signal" points to a red down-triangle above them.

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.

Cross-platform consistency

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.