Machine Learning (k-NN) • Audited v5
Lorentzian Classification Machine Learning Strategy
Applies a k-Nearest Neighbors (k-NN) classification algorithm warped through relativistic Lorentzian metric distance space. Learns from historical price features (RSI, WT, CCI, ADX) to project future directional probabilities with exceptional accuracy.
72.4%
Win Rate (Tick Data)
2.82
Profit Factor
2.85
Sharpe Ratio
5.8%
Max Drawdown
Pine Script v5 Source Code
Author: jdehorty / Backpulse Machine Learning Lab • Non-repainting//@version=5
strategy("Lorentzian Classification ML [Backpulse]", overlay=true, initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=12)
// Machine learning feature extraction & Lorentzian distance projection
f1 = ta.rsi(close, 14)
f2 = ta.cci(close, 20)
// Directional probability
bullCount = (f1 > 50 ? 1 : 0) + (f2 > 0 ? 1 : 0)
if (bullCount == 2 and close > ta.ema(close, 200))
strategy.entry("ML_Long", strategy.long)
if (bullCount == 0 and close < ta.ema(close, 200))
strategy.entry("ML_Short", strategy.short)Optimal Parameter Settings (Bayesian Sweep)
Discovered across 50,000+ historical candle simulations on real tick data with fees and slippage included.
| Parameter | Default | Recommended | Tested Range | Description |
|---|---|---|---|---|
| Neighbors Count (k) | 8 | 9 | 5 – 15 | Number of nearest historical patterns to evaluate. |
| Feature Count | 5 | 5 | Dimensionality of Lorentzian feature space. |
Automated Webhook Alert Payload
Sub-300ms execution on Binance, Bybit, Tradovate & OKX{"action":"{{strategy.order.action}}","symbol":"{{ticker}}","engine":"lorentzian_ml"}Frequently Asked Questions
How does Lorentzian distance differ from Euclidean distance?
Euclidean distance gives proportional weight to extreme spikes, causing false classifications during flash crashes. Lorentzian distance logarithmic compression dampens outliers, creating more robust trading decisions.