OPEN-SOURCE SCRIPT
EDUVEST Lorentzian Classification

EDUVEST Lorentzian Classification - Machine Learning Signal Detection
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
█ ORIGINALITY
This indicator enhances the original Lorentzian Classification concept by jdehorty with EduVest's visual modifications and alert system integration. The core innovation is using Lorentzian distance instead of Euclidean distance for k-NN classification, providing more robust pattern recognition in financial markets.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
█ WHAT IT DOES
- Generates BUY/SELL signals using machine learning classification
- Displays kernel regression estimate for trend visualization
- Shows prediction values on each bar
- Provides trade statistics (Win Rate, W/L Ratio)
- Includes multiple filter options (Volatility, Regime, ADX, EMA, SMA)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
█ HOW IT WORKS
【Lorentzian Distance Calculation】
Unlike Euclidean distance, Lorentzian distance uses logarithmic transformation:
d = Σ log(1 + |xi - yi|)
This provides:
- Better handling of outliers
- More stable distance measurements
- Reduced sensitivity to extreme values
【Feature Engineering】
The classifier uses up to 5 configurable features:
- RSI (Relative Strength Index)
- WT (WaveTrend)
- CCI (Commodity Channel Index)
- ADX (Average Directional Index)
Each feature is normalized using the n_rsi, n_wt, n_cci, or n_adx functions.
【k-Nearest Neighbors Classification】
1. Calculate Lorentzian distance between current bar and historical bars
2. Find k nearest neighbors (default: 8)
3. Sum predictions from neighbors
4. Generate signal based on prediction sum (>0 = Long, <0 = Short)
【Kernel Regression】
Uses Rational Quadratic kernel for smooth trend estimation:
- Lookback Window: 8
- Relative Weighting: 8
- Regression Level: 25
【Filters】
- Volatility Filter: Filters signals during extreme volatility
- Regime Filter: Identifies market regime using threshold
- ADX Filter: Confirms trend strength
- EMA/SMA Filter: Trend direction confirmation
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
█ HOW TO USE
【Recommended Settings】
- Timeframe: 15M, 1H, 4H, Daily
- Neighbors Count: 8 (default)
- Feature Count: 5 for comprehensive analysis
【Signal Interpretation】
- Green BUY label: Long entry signal
- Red SELL label: Short entry signal
- Bar colors: Green (bullish) / Red (bearish) prediction strength
【Trade Statistics Panel】
- Winrate: Historical win percentage
- Trades: Total (Wins|Losses)
- WL Ratio: Win/Loss ratio
- Early Signal Flips: Premature signal changes
【Filter Recommendations】
- Enable Volatility Filter for ranging markets
- Enable Regime Filter for trend confirmation
- Use EMA Filter (200) for higher timeframes
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
█ CREDITS
Original Lorentzian Classification concept and MLExtensions library by jdehorty.
Enhanced with visual modifications and alert integration by EduVest.
License: Mozilla Public License 2.0
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
█ ORIGINALITY
This indicator enhances the original Lorentzian Classification concept by jdehorty with EduVest's visual modifications and alert system integration. The core innovation is using Lorentzian distance instead of Euclidean distance for k-NN classification, providing more robust pattern recognition in financial markets.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
█ WHAT IT DOES
- Generates BUY/SELL signals using machine learning classification
- Displays kernel regression estimate for trend visualization
- Shows prediction values on each bar
- Provides trade statistics (Win Rate, W/L Ratio)
- Includes multiple filter options (Volatility, Regime, ADX, EMA, SMA)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
█ HOW IT WORKS
【Lorentzian Distance Calculation】
Unlike Euclidean distance, Lorentzian distance uses logarithmic transformation:
d = Σ log(1 + |xi - yi|)
This provides:
- Better handling of outliers
- More stable distance measurements
- Reduced sensitivity to extreme values
【Feature Engineering】
The classifier uses up to 5 configurable features:
- RSI (Relative Strength Index)
- WT (WaveTrend)
- CCI (Commodity Channel Index)
- ADX (Average Directional Index)
Each feature is normalized using the n_rsi, n_wt, n_cci, or n_adx functions.
【k-Nearest Neighbors Classification】
1. Calculate Lorentzian distance between current bar and historical bars
2. Find k nearest neighbors (default: 8)
3. Sum predictions from neighbors
4. Generate signal based on prediction sum (>0 = Long, <0 = Short)
【Kernel Regression】
Uses Rational Quadratic kernel for smooth trend estimation:
- Lookback Window: 8
- Relative Weighting: 8
- Regression Level: 25
【Filters】
- Volatility Filter: Filters signals during extreme volatility
- Regime Filter: Identifies market regime using threshold
- ADX Filter: Confirms trend strength
- EMA/SMA Filter: Trend direction confirmation
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
█ HOW TO USE
【Recommended Settings】
- Timeframe: 15M, 1H, 4H, Daily
- Neighbors Count: 8 (default)
- Feature Count: 5 for comprehensive analysis
【Signal Interpretation】
- Green BUY label: Long entry signal
- Red SELL label: Short entry signal
- Bar colors: Green (bullish) / Red (bearish) prediction strength
【Trade Statistics Panel】
- Winrate: Historical win percentage
- Trades: Total (Wins|Losses)
- WL Ratio: Win/Loss ratio
- Early Signal Flips: Premature signal changes
【Filter Recommendations】
- Enable Volatility Filter for ranging markets
- Enable Regime Filter for trend confirmation
- Use EMA Filter (200) for higher timeframes
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
█ CREDITS
Original Lorentzian Classification concept and MLExtensions library by jdehorty.
Enhanced with visual modifications and alert integration by EduVest.
License: Mozilla Public License 2.0
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Custom Pine Script Development → fiverr.com/eduvest | 30 Years STEM Education × AI-Powered Trading Tools
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Custom Pine Script Development → fiverr.com/eduvest | 30 Years STEM Education × AI-Powered Trading Tools
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.