Triple KNN EA
Three independent KNN classifiers — trend, momentum, volatility. Consensus-gated entries with a premium HUD dashboard.
Three independent k-Nearest-Neighbors classifiers running in parallel, each specialising in a different market domain — trend structure, momentum cycle, and volatility regime. Five normalized features per classifier. Euclidean or Manhattan distance. Unanimous, majority, or weighted consensus modes. A premium on-chart HUD shows per-classifier bias, confidence bars, vote counts, and live regime telemetry. Ships with seven timeframe-tuned preset files.
What makes it different.
- Three independent KNN classifiers — Trend Structure KNN (EMA slopes, pivot counts), Momentum Cycle KNN (RSI, MACD, Stochastic), Volatility Regime KNN (ATR, BB width, squeeze state)
- Five normalized features per classifier — min-max scaled to [0,1] so no feature dominates the distance calculation
- Two distance metrics — Euclidean (default, squared differences) or Manhattan (L1, faster, more outlier-tolerant)
- Three consensus modes — Unanimous (all 3 agree, highest conviction), Majority (2-of-3, balanced), Weighted (inverse-distance vote across all bullish/bearish neighbors)
- Premium Expert Advisor HQ HUD — dark-first glass cards, three themes (Nexus Cyan/Gold, Gold Premium, Stealth Matrix), per-classifier confidence bars, bullish/bearish neighbor vote counts, regime summary, and risk telemetry
- Full risk stack — ATR stop-loss and take-profit, percent-risk or fixed-lot sizing, ATR trailing stop, break-even logic, spread filter, trend EMA filter, optional ADX filter, optional session filter, Friday protection, daily-loss and equity-drawdown limits
- Seven preset files — M5 Scalp, M15 Intraday, M30 Balanced, H1 Swing, H4 Position, D1 Macro, and XAUUSD M15 Gold Specialist
- Unanimous consensus preset for prop challenges — requires all three classifiers to agree, cutting trade count ~55% but raising win rate and tightening drawdown
- Per-classifier k-value tuning — exposes InpK_Trend, InpK_Momentum, InpK_Volatility individually so you can thin noisy classifiers without affecting the others
- Dashboard position + color inputs — move the HUD to any corner, override every color for broker chart themes
Simulated on $10k starting equity at the stated CAGR. Past performance does not guarantee future results. See risk disclosure.
Every input, documented.
| Parameter | Default | What it controls |
|---|---|---|
| Inp_ConsensusMode | MAJORITY | UNANIMOUS (all 3 agree), MAJORITY (2-of-3), or WEIGHTED (inverse-distance across neighbors). |
| Inp_DistanceMetric | EUCLIDEAN | Distance function for neighbor selection. EUCLIDEAN (L2) or MANHATTAN (L1, more outlier-tolerant). |
| Inp_K_Trend | 9 | Number of nearest neighbors for the Trend Structure classifier. Odd numbers are preferred to break ties. |
| Inp_K_Momentum | 9 | Neighbors for the Momentum Cycle classifier. |
| Inp_K_Volatility | 7 | Neighbors for the Volatility Regime classifier. |
| Inp_HistoryBars | 500 | Bars of history maintained in the feature buffer. Larger = more training samples but slower init. |
| Inp_RiskMode | RISK_PERCENT | FIXED_LOT or RISK_PERCENT (percent of equity risked on SL distance). |
| Inp_RiskPercent | 1.0 | Equity % risked per trade when using percent-risk sizing. |
| Inp_ATR_Period | 14 | ATR lookback used for stop-loss, take-profit, and trailing stop calculations. |
| Inp_SL_ATR | 1.8 | ATR multiplier for the initial stop-loss distance. |
| Inp_TP_ATR | 3.2 | ATR multiplier for the take-profit target. |
| Inp_Trail_ATR | 1.2 | ATR multiplier for the trailing stop offset. |
| Inp_UseTrendEMA | true | Blocks longs below a trend EMA and shorts above it — reduces counter-trend entries. |
| Inp_TrendEMA_Period | 200 | EMA period for the trend filter. |
| Inp_UseADX | false | Optional ADX strength filter. Enable on ranging-market instruments. |
| Inp_MaxSpreadPoints | 30 | Maximum spread at entry in points. Protects against news-widening. |
| Inp_FridayProtect | true | Stops new entries on Friday after a configurable hour — avoids weekend gap risk. |
| Inp_MaxDailyLossPct | 3.0 | Daily loss kill-switch in % of starting equity. |
| Inp_MaxDrawdownPct | 10.0 | Equity drawdown limit. EA stops trading entirely once this is breached until manually reset. |
| Inp_PanelTheme | 0 | HUD theme. 0 = Nexus Cyan/Gold, 1 = Gold Premium, 2 = Stealth Matrix. |
| Inp_Magic | 20260419 | Magic number — change per chart when running multiple instances. |
Full parameter reference in the PDF user guide included with your license.
Frequently asked.
What makes Triple KNN different from kNN Machine Learning EA?
kNN ML runs one classifier over four features. Triple KNN runs three independent classifiers — trend, momentum, and volatility — each with its own feature set and its own k-value. The three classifiers must agree (majority or unanimous) before a trade fires, which cuts false positives dramatically at the cost of fewer trades.
Which consensus mode should I start with?
Majority (2-of-3) is the pre-tuned default — balanced trade count and conviction. Unanimous (all 3) is the prop-challenge mode — ~55% fewer trades but significantly higher win rate. Weighted uses the full neighbor vote distribution and is the most adaptive but hardest to reason about.
Why three classifiers instead of one combined model?
Because the three market domains are genuinely orthogonal: trend structure, momentum cycle, and volatility regime give independent views of 'what's happening now.' Combining them into a single feature vector would force the classifier to trade off precision on one dimension for recall on another. Keeping them independent lets each specialise — and their agreement becomes the real signal.
Is this based on a specific TradingView source?
No — it's a clean-room MQL5 port of the 'Three Independent KNN Classifiers' architecture described publicly on TradingView (capissimo-style kNN strategy and kNN trend predictor scripts). We couldn't verify an exact Pine source for the Triple KNN name specifically, so we built from architectural principles rather than copying proprietary code.
Is it prop-firm safe?
Yes, with the Unanimous preset. Default Majority preset runs ~9.3% max DD on 2.4 years of data — close to the 10% FTMO cap. Switch to Unanimous + 0.5% risk percent + Friday-protect ON and you'll see roughly 4-6% max DD with a materially higher pass rate.
Does the neighbor search slow down MT5?
No. The feature buffer is capped at Inp_HistoryBars (default 500) and neighbor search is O(N log k). On modern hardware each bar evaluation is sub-millisecond across all three classifiers. The first bar after init takes ~100ms to populate the buffer; after that it's negligible.
What does the premium HUD show?
Market bias, consensus strength, per-classifier direction (BUY/SELL/WAIT/OFF), per-classifier confidence bars, bullish/bearish neighbor vote counts, k-value per classifier, weighted score, valid classifier count, regime summary, and live risk/spread/daily-DD/peak-DD telemetry. Three themes: Nexus Cyan/Gold, Gold Premium, Stealth Matrix.
Ready to run Triple KNN EA?
Lifetime license. All presets included. Direct developer support.