Lorentzian Classification Strategy
Apr 14, 2023

The Lorentzian Classification Strategy indicator provides a comprehensive trading system based on machine learning and multi-filter technical analysis to identify and capitalize on trending market moves. It combines advanced Lorentzian classification with trend filters and risk management tools to offer a robust backtesting and live-analysis environment.
Usage
The Usage section highlights how to interpret the signals generated by the integration of Lorentzian classification, moving averages, and volatility filters.
- Long Positions: A long signal is generated when the close price is above the 200-period EMA and the Lorentzian Classification model issues a buy signal.
- Short Positions: A short signal is generated when the close price is below the 200-period EMA and the model issues a sell signal.
- Exit Strategy: The strategy employs a dual-exit approach. Half of the position is closed at a fixed 3:1 risk/reward ratio. The remaining half is closed when either the model provides an opposing signal or the integrated Supertrend filter indicates a trend reversal.
- Stop Loss & Break Even: Initial stop losses are determined by an ATR-based stop loss or recent swing highs/lows. A break-even point is automatically triggered once a 1:1 risk/reward ratio is achieved.
- Risk Management: Users can define a specific percentage of their account to risk per trade. The indicator includes a position size calculator that displays the required USD amount in the top corner of the chart to maintain consistent risk.
Details
The strategy is built upon the Lorentzian Classification model, which utilizes a K-Nearest Neighbors (KNN) approach modified for Lorentzian space to classify market regimes.
Key implementation details include:
- Feature Engineering: The model uses five customizable technical features (RSI, WaveTrend, CCI, and ADX) to categorize market data.
- Filters: To reduce noise, the strategy incorporates a Volatility Filter, ADX Filter, and Regime Filter (Kernel Regression) to ensure trades are only taken during high-probability trending periods.
- Backtesting Utilities: The script includes advanced logic for simulating capital additions or withdrawals (fixed or percentage-based) over time, as well as leverage simulation for more realistic performance tracking.
Settings
General Settings
- Source: The data input for the ML model (usually the close price).
- Neighbors Count: The number of historical neighbors the KNN model evaluates.
- Max Bars Back: Controls the range of history used for calculations; reducing this can improve loading speeds.
Feature Engineering
- Feature 1-5: Allows the selection of RSI, WT, CCI, or ADX as inputs for the machine learning model.
- Parameter A/B: Adjusts the internal periods or settings for each selected feature.
Filters
- Use EMA/SMA Filter: Toggles the use of moving averages to ensure trades align with the long-term trend.
- Regime/ADX Threshold: Sets the sensitivity for trend detection; lower thresholds allow more trades, while higher thresholds are more restrictive.
Stop Loss & Risk Management
- ATR Multiplier: Sets the distance for the ATR stop loss.
- Stoploss Source: Switches between ATR-based stops or Swing High/Low detection.
- % Account Risk per Trade: The percentage of equity to be risked on a single trade.
- Use Leverage: If enabled, the strategy will simulate using borrowed funds if the required position size exceeds current capital.
Display Settings
- Show Supertrend/EMA: Toggles the visibility of the underlying filter indicators.
- Show Bar Predictions: Displays the raw integer output of the ML model on each bar.
- Date/Session Filters: Restricts backtesting and signal generation to specific dates or hours of the day.
FAQ
How does the Lorentzian Classification differ from standard KNN? Lorentzian Classification uses a distance metric better suited for non-linear, "fat-tailed" financial data, potentially reducing the impact of outliers compared to standard Euclidean distance.
Why are signals not appearing on every trend change? Signals only appear when all conditions—ML classification, EMA trend alignment, and volatility filters—are met simultaneously to ensure higher quality entries.
How do I access the Lorentzian Classification Strategy? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Unlock Unlimited Access to the LuxAlgo Library
Upgrade your plan to get all indicators, strategies, charts, and full access to Quant, our AI agent.
Trading & investing are risky and many will lose money in connection with trading and investing activities. All content on this site is not intended to, and should not be, construed as financial advice. Decisions to buy, sell, hold or trade in securities, commodities and other investments involve risk and are best made based on the advice of qualified financial professionals. Past performance does not guarantee future results.
Hypothetical or Simulated performance results have certain limitations. Unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, including, but not limited to, lack of liquidity. Simulated trading programs in general are designed with the benefit of hindsight, and are based on historical information. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.
Testimonials appearing on this website may not be representative of other clients or customers and is not a guarantee of future performance or success.
As a provider of technical analysis tools and strategies, we do not have access to the personal trading accounts or brokerage statements of our customers. As a result, we have no reason to believe our customers perform better or worse than traders as a whole based on any content, tool, or platform feature we provide.
Charts used on this site are by TradingView in which the majority of our technical indicators are built on. TradingView® is a registered trademark of TradingView, Inc. www.TradingView.com TradingView® has no affiliation with the owner, developer, or provider of the Services described herein.
Market data is provided by CBOE, CME Group, BarChart, Massive, CoinAPI. Select U.S. equities data is provided through Massive. CBOE BZX real-time U.S. equities data is licensed from CBOE and provided through BarChart. Real-time futures data is licensed from CME Group and provided through BarChart. Select cryptocurrency data, including major coins, is provided through CoinAPI. All data is provided “as is” and should be verified independently for trading purposes.
This does not represent our full Disclaimer. Please read our full disclaimer.
© 2026 LuxAlgo Global, LLC.

