Skip to main content

Installing Lorentzian Classification on MetaTrader 5

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 pulls features from each bar's price data, computes Lorentzian distances to historical bars in the lookback window, and labels the current bar according to what happened after the closest historical matches. The output label of LC is an indication of market state.


Section 2 - Set up MetaTrader 5​

2A. What you need before you start​

  • A Windows PC running Windows 7 or later
  • 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.


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 free demo account. A demo account uses simulated data, so no real money or payment information is involved.

Screenshot of the Open an Account wizard, first screen, with "Open a free demo account" highlighted.

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.

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, MT5 was probably not open when you clicked Download. You can try to manually add the LC indicator instead - see Section 4 below.


Section 4 - Add the indicator to MetaTrader 5 manually​

If you already have the LC indicator installed, you may skip to Section 5.

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.

If the auto-install didn't work, copy the downloaded file into the Indicators folder now.

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.


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. It'll either be visible under Indicators if you installed manually, or under Indicators/Market if the auto-install worked.

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.

There are a lot of parameters for the LC indicator. Learn more about them here. Leave all parameters at their defaults for now. Click OK.


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 number of neighbors considered. To assign it, the algorithm takes the current bar's feature vector and finds the most similar bars in the historical lookback window using Lorentzian distance. Those nearest neighbors vote on the label.

A bullish label means the cumulative vote from the neighbors was positive (+1 to +n). This means the current bar's features most closely match historical bars that preceded upward movement.

A bearish label means the vote was negative - the same logic in the other direction.

A cumulative vote of 0 is also possible. This can be read as a neutral label.

A sustained run of positive or negative votes means LC is indicating a stable trend, either bullish or bearish. When labels flip back and forth across consecutive bars, that means the current features do not cleanly resemble any dominant historical pattern. Read that as low classifier conviction rather than as a signal that a move is imminent.

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 indicator is built from the same logic as the TradingView Pine Script version, so on identical OHLCV data both should classify the same.


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 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.