Lorentzian Classification EA for MT5: A Machine Learning Trading System Built for Smarter Market Decisions
If you are looking for an Expert Advisor that goes beyond fixed indicator rules and instead learns from historical market behavior, the Lorentzian Classification EA was built for that purpose. This MT5 trading system combines Lorentzian Distance, K-Nearest Neighbors (KNN) classification, and kernel regression confluence into a structured framework designed to identify higher-quality directional opportunities.
Designed for MetaTrader 5 users who want more than a simple crossover robot, this EA uses a multi-feature pattern recognition model to compare the current market state with similar historical conditions and then estimate likely future direction. It also includes a layered filter stack, ATR-based risk tools, multiple set files, dashboard monitoring, and backtesting workflows that make it practical for both newer and experienced traders.

What makes Lorentzian Classification different?
Traditional EAs often rely on rigid formulas that react to price in the same way every time, but Lorentzian Classification approaches the market as a pattern-recognition problem. On every closed bar, the system builds a feature vector from indicators such as RSI, WaveTrend, CCI, and ADX, then searches historical data for the most similar setups before forming a bullish or bearish prediction.
A key advantage is the use of the Lorentzian Distance metric rather than standard Euclidean distance. In financial markets, this matters because the Lorentzian approach compresses large outlier differences instead of letting extreme spikes dominate the similarity calculation, which helps the classifier remain more stable during volatile conditions.
How the EA generates signals
The EA scans up to 2,000 historical bars, evaluates similarity using Lorentzian distance, and selects the nearest neighbors for classification, with the default neighbor count set to 8. Each neighbor is labeled according to whether price moved up or down over the next four bars, and the sum of those labels becomes the final prediction score.
A strong positive score signals bullish consensus, while a strong negative score signals bearish consensus. That prediction must still pass through a filter stack that can include volatility filtering, regime detection, ADX strength filtering, and long-term EMA or SMA trend alignment before a trade is allowed.
The system then adds another confirmation layer through Nadaraya-Watson kernel regression. Long trades require bullish kernel alignment, short trades require bearish alignment, and traders can also enable dynamic exits based on kernel crossovers instead of relying only on a fixed holding period.
Built for MT5 users who want flexibility
One of the strongest parts of the Lorentzian Classification EA is that it is not locked into a single trading style. The manual includes seven pre-configured set files covering M15 scalping, M30 intraday trading, H1 swing trading, H4 position trading, D1 long-term trend trading, an H1 XAUUSD profile, and an H4 conservative profile built for lower-risk or prop-style trading.
For most users, the H4 Position profile is the recommended starting point because the original Lorentzian Classification research was designed and optimized around the 4H to 12H range. Traders who want faster activity can explore the lower-timeframe profiles, while more conservative users can start with the H4 Conservative or D1 Long-Term profiles.

Trade management and risk controls
The EA includes both fixed-lot and risk-based position sizing, with ATR-based stop loss and take profit settings available by default. Users can also configure trailing stops, breakeven logic, partial closes, spread limits, session filters, and maximum open positions to better match their trading conditions and account rules.
This makes the system useful not only for standard retail trading but also for traders who need tighter control over drawdown, execution quality, and session exposure. The manual specifically recommends keeping risk per trade controlled, monitoring total exposure across pairs, and using unique magic numbers when running multiple chart instances.
Visual feedback on the chart
The on-chart dashboard gives traders a live view of what the EA is seeing internally. It can display the current signal state, prediction score, kernel trend, feature values, filter pass or fail status, position information, spread conditions, and basic trade statistics.
Signal arrows can also be shown directly on the chart for visual review of entries. For VPS environments or optimization sessions, the dashboard can be disabled to reduce CPU usage since those display elements are visual only and do not affect trade logic.
Backtesting and optimization workflow
The Lorentzian Classification EA was built with serious testing in mind. The manual recommends using MT5 Strategy Tester with “Every tick based on real ticks,” testing at least two years of data, and matching the set file to the selected timeframe for more reliable analysis.
Rather than optimizing everything at once, the suggested workflow is to tune features first, then neighbor count, then filters, and finally trade management parameters. That phased approach helps reduce curve fitting and supports stronger walk-forward validation on unseen data.
When reviewing results, the manual highlights practical metrics such as profit factor, win rate, drawdown, Sharpe ratio, recovery factor, and total trade count. It also emphasizes that strong backtests should be followed by out-of-sample validation before moving to live conditions.

Live trading considerations
Like any advanced trading system, the best results come from pairing the EA with the right environment. The manual recommends MT5 brokers with fast execution, tight spreads, stable uptime, and support for hedging accounts, especially for lower-timeframe profiles where costs matter more.
A VPS is strongly recommended for uninterrupted operation, with low latency to the broker server and enough resources to run MT5 smoothly. The documentation also advises traders to account for high-impact events such as NFP, CPI, FOMC, and ECB releases by pausing the EA around major news when needed.
Who this EA is best suited for
The Lorentzian Classification EA is a strong fit for MT5 users who want a more adaptive, research-driven system instead of a basic indicator trigger robot. It is especially appealing to traders who value structured signal confirmation, configurable risk tools, multi-timeframe deployment, and a framework that can be tested and optimized with discipline.
Beginners can start with the recommended H4 profile and the included set files, while advanced users can go deeper into parameter tuning, walk-forward testing, and pair-specific optimization. That balance between accessibility and depth is one of the reasons this EA stands out as a professional MT5 release.

Final thoughts
Lorentzian Classification EA brings together machine learning logic, trend confirmation, practical trade management, and MT5-friendly deployment into one professional package. For traders who want an automated system that is structured, configurable, and built around historical pattern recognition rather than fixed-rule simplicity, this release offers a compelling framework to explore.
Lorentzian Classification EA for MetaTrader 5
Risk Warning: Trading leveraged products carries significant risk, and past performance or backtested results do not guarantee future outcomes.
This Expert Advisor is a trading tool, not financial advice, and users should test thoroughly and manage risk carefully before trading live.


