说明
Machine Learning: Lorentzian Classification
An approximate k-nearest-neighbours classifier that measures similarity between market states using Lorentzian Distance instead of Euclidean Distance. Lorentzian geometry compresses the influence of outliers and volatility shocks, so historical analogues stay comparable across different market regimes. Each bar is scored against a chronologically spaced set of neighbours, and the resulting prediction is confirmed by Nadaraya-Watson kernel regression before a signal is issued.
CORE ENGINE
- Approximate Nearest Neighbours search with a minimum 4-bar spacing between neighbours, avoiding oversampling of adjacent price action
- Lorentzian Distance metric across up to 5 feature dimensions
- Neighbours Count adjustable from 1 to 100 (default 8)
- Max Bars Back up to the full chart history, plus an Include Full History mode for rare historical patterns
- Prediction value printed on every bar, from -N to +N, where N is the neighbours count
FEATURE ENGINEERING
- Five configurable feature slots, each selectable as normalised RSI, WaveTrend, CCI or ADX
- Independent length and smoothing parameters per feature
- Feature Count reducible from 5 to 2 for faster, coarser models
FILTERS
- Volatility filter (recent vs historical ATR)
- Regime filter based on a Kalman-style adaptive slope estimate, with adjustable threshold
- ADX filter with configurable threshold
- Optional EMA and SMA trend filters
- Kernel filter: signals only in the direction of the kernel estimate
KERNEL REGRESSION
- Rational Quadratic kernel for the main estimate, Gaussian kernel for crossover detection
- Adjustable lookback window, relative weighting, regression level and crossover lag
- Enhanced smoothing mode for fewer colour transitions and more entry signals
- Kernel line plotted in two colours, bullish and bearish
SIGNALS AND ALERTS
- BUY and SELL arrows with bold text labels, positioned by ATR so they scale across instruments
- Configurable label text and gap, so the visuals fit any chart style
- Optional exit markers, either fixed at 4 bars or dynamic via kernel logic
- Sound, popup and email alerts on new signals
- Alert on bar close by default, or intrabar for faster reaction
- One alert per bar, with no alert burst when the indicator is attached
ON-CHART PANEL
- Semi-transparent dark panel, collapsible from the header
- Live direction, prediction value, confidence, kernel state, trend filter state and filter pass/fail
- Trade statistics block: win rate, trade count, win/loss ratio and early signal flips
- Toggle buttons for bar colouring and signal visibility
DISPLAY
- Bar colouring by prediction strength, in gradient or solid mode
- Confidence gradient that scales colour intensity with model conviction
- Adjustable visual range to keep large charts responsive
NOTES
- The trade statistics are a calibration aid for tuning features and filters. They are not a backtest and do not account for spread, commission, slippage or position sizing. Validate any configuration in a proper backtest before trading it.
- Like the original, the model evaluates the forming bar in real time. Values settle once the bar closes. Use Alert On Bar Close if you want confirmed signals only.
- Recommended starting points: 5m to 4h timeframes, default 8 neighbours, all 5 features, volatility and regime filters enabled.
Based on the open-source Lorentzian Classification indicator by jdehorty, published under the Mozilla Public License 2.0.
This indicator is a technical analysis tool. It does not constitute financial advice, and past behaviour of any configuration does not predict future results.
