Adaptive SuperTrend KMeans MT5

Adaptive SuperTrend KMeans is a MetaTrader 5 port of the open-source TradingView indicator "Machine Learning Adaptive SuperTrend" by AlgoAlpha (Mozilla Public License 2.0). All credit for the idea and the original code goes to AlgoAlpha.

Also available for MetaTrader 4 (free): https://www.mql5.com/en/market/product/198796

At a glance

  • What it is: a SuperTrend whose band width adapts to the current volatility level
  • Volatility levels: K-means sorts recent ATR values into high, medium and low clusters
  • Faithful port: same math and the same defaults as the original Pine Script code
  • No repainting: arrows and cluster numbers are drawn only on closed bars
  • Price: free and open source

How it works

  1. Volatility: ATR with Wilder's smoothing, exactly like TradingView's ta.atr.
  2. Clusters: K-means groups the last 100 ATR values into high, medium and low volatility (strict assignment, as in the original).
  3. Band: the SuperTrend uses (high + low) / 2 plus or minus factor x the centroid of the current cluster, so the band widens in volatile markets and tightens in quiet ones.

On the chart

  • Trend line that breaks when the trend flips (green up, red down)
  • Gradient fill between the line and the candles, drawn with native MetaTrader 5 fills (fast, no chart objects)
  • Arrows at each trend flip, cluster numbers 3 / 2 / 1 on recent bars
  • Statistics table: cluster centroids, cluster sizes and the current volatility level. Click its title to fold it; put it in any corner; its colors follow your chart, dark or light.

Made for MetaTrader 5

  • Alerts on a trend shift and/or a change of volatility level: popup, sound only, push notification to the MetaTrader 5 mobile app, or e-mail. Once per bar, on the closed bar.
  • Tested bar by bar against an independent reference calculation on gold H1 and M15 and on EURUSD M5 and H4: every value matches, and no value changes after its bar has closed.
  • Readable numbers on any symbol: values below 1 show all price digits (the original rounds to 2 decimals).

Parameters (defaults = original)

  • ATR Length 10, SuperTrend Factor 3.0
  • Training Data Length 100; initial high / medium / low percentile guesses 0.75 / 0.5 / 0.25
  • Transparency 70 (near the line) and 95 (near the candle); bullish and bearish colors
  • Chart options: bars to calculate, closed-bar-only signals, line width, fill, arrows, cluster numbers, table position, alerts

For EA developers (iCustom): buffers 0 = up trend line, 1 = down trend line, 2 = bullish flip, 3 = bearish flip, 4 = SuperTrend, 5 = direction (-1 up, +1 down, as in Pine), 6 = cluster (0 high, 1 medium, 2 low), 7 = centroid used for the band, 8 = ATR. EMPTY_VALUE means no value. Simplest call with the default inputs: iCustom(_Symbol, _Period, "Market\\Adaptive SuperTrend KMeans MT5") . If you pass inputs, each input group heading counts as one parameter (pass an empty string for it); set Draw_Objects = false when an EA calls it.

Values match TradingView when both use the same price feed. Different brokers give slightly different ATR values.

Source code and license: free and open source under the Mozilla Public License 2.0 (MPL-2.0), the same as the original. The full MQL5 source code is published in the MQL5 Code Base by the same author.

This is a visual tool. It does not place trades and does not predict prices. Test any rule built on it before you trade with it.

More from the author (MetaTrader 5):

Mais do autor
A line-by-line port of "Chandelier Exit" , 2019-present Alex Orekhov ( everget ), distributed under the GPL-3.0 license. The original is published on TradingView. This port is released under the same license. Also available for MetaTrader 5 (free): Chandelier Exit with Signal Stats MT5 - https://www.mql5.com/en/market/product/209460 The logic is exactly the original's: ATR = multiplier × ta.atr(length) (Wilder RMA, seeded with an SMA). Long stop = highest(close or high, length) − ATR. It only
FREE
A line-by-line port of "UT Bot Alerts" by QuantNomad (Pine v4, 2020). The idea is by HPotter and the first version by Yo_adriiiiaan. The original is published as open source on TradingView. All credit goes to those authors. Also available for MetaTrader 5 (free): UT Bot Alerts with Signal Stats MT5 - https://www.mql5.com/en/market/product/209458 The logic is exactly the original's: ATR is atr(c) = Wilder RMA seeded with an SMA. The built-in iATR is not used. Trailing stop follows the original ne
FREE
A line-by-line port of "Range Filter Buy and Sell 5min" : Also available for MetaTrader 5 (free): Range Filter Buy Sell with Signal Stats MT5 - https://www.mql5.com/en/market/product/209459 original Range Filter by DonovanWall simplified version by guikroth Pine v5 update by tvenn It is published as open source on TradingView. All credit goes to those authors. The logic is exactly the original's: Smoothed range = EMA(EMA(|close − close[1]|, period), 2 × period − 1) × multiplier. Each EMA is seed
FREE
Adaptive SuperTrend K-Means is an MT4 port of the open-source TradingView indicator "Machine Learning Adaptive SuperTrend" by AlgoAlpha (Mozilla Public License 2.0). All credit for the idea and the original code goes to AlgoAlpha. Also available for MetaTrader 5 (free): Adaptive SuperTrend KMeans MT5 - https://www.mql5.com/en/market/product/209466 At a glance What it is: a SuperTrend whose band width adapts to the current volatility level Volatility levels: K-means sorts recent ATR values into h
FREE
Gold Lighthouse
Thanh Trung Tran
Gold Lighthouse is a free, fully automated Expert Advisor for XAUUSD. It trades rarely and calmly - a few trades per month, long or short - and every order carries a stop loss and a take profit from the first second. There is never more than one position open, and a trade that reaches neither level is closed after a time limit. No martingale, no grid. Historical test results are shown below with their settings and costs; they are not forecasts. Backtest highlight - gold above 3000 Start balance
FREE
A backtest looks great. Then the EA runs live and the numbers are different, and nobody can say why. Was it slippage, missed signals, a restart or a manual trade? Or was the backtest flattering? Also available for MetaTrader 5 (free): Tester vs Live Trade Matcher MT5 - https://www.mql5.com/en/market/product/209467 TesterVsLive answers that trade by trade. It never opens, modifies or closes orders. What you get: Verdict: green (live matches backtest), amber (partly matches) or red (live differs).
FREE
Gold Priority Ensemble combines several independent gold strategies in one Expert Advisor for XAUUSD. Only one position is open at a time, every order carries a stop loss from the first second, and each strategy keeps its own exit management. Historical test results are shown below with their settings and costs; they are not forecasts. Who it is for Traders who want one gold EA with several entry ideas but only one open position at a time Traders who accept that trades can last from minutes to s
Gold Swing Pullback is an automated trend-following Expert Advisor for XAUUSD. It waits until the trend lines up, enters on a pullback within that trend, and protects every order with a stop loss and a take profit from the first second. Frequent small losses and occasional larger trend winners. Historical test results are shown below with their settings and costs; they are not forecasts. Who it is for Traders comfortable with frequent small losses and occasional large trend winners Traders who p
Gold Inside Day Breakout is a calm, fully automated Expert Advisor for XAUUSD. It trades only on days when the market has prepared a clear setup, takes at most one trade per day, protects every order with a stop loss and lets winning trades run with a trailing stop. Expect few trades, frequent small losses and occasional larger winners. Historical test results are shown below with their settings and costs; they are not forecasts. Who it is for Traders who prefer a few rule-based trades per month
Gold Order Flow
Thanh Trung Tran
Gold Order Flow is a fully automated Expert Advisor for XAUUSD that reacts to unusually strong moves in gold - long or short. Every order carries a stop loss and a take profit from the first second, there is never more than one position open, and trades are time-limited. No martingale, no grid. This is the same EA that trades the Gold Order Flow signal on MQL5, so you can watch it on a real account before you buy. Historical test results are shown below with their settings and costs; they are no
GoldSwing T24
Thanh Trung Tran
GoldSwing T24 is a fully automated trend Expert Advisor for XAUUSD. It trades only with the prevailing trend and closes every trade within 24 hours at the latest - no position is left open for long. A stop loss and take profit on every order, plus break-even protection after the first move. This is the same EA that trades the GoldSwing T24 signal on MQL5, so you can watch it on a real account before you buy. Historical test results are shown below with their settings and costs; they are not fore
Gold Entry
Thanh Trung Tran
Gold Entry runs two independent trend systems for XAUUSD in one Expert Advisor. Each system reads the market in its own way and manages its own position, so the EA does not depend on a single rule. A stop loss on every order and at most one position per system. This is the same EA that trades the Gold Entry signal on MQL5, so you can watch it on a real account before you buy. Historical test results are shown below with their settings and costs; they are not forecasts. Also available for MetaTra
GoldIBH
Thanh Trung Tran
GoldIBH combines three complementary gold strategies in one Expert Advisor. Each one looks for a different market situation and manages its own position and stop loss, so the EA can find opportunities in more conditions than a single-rule EA. This is the same EA that trades the GoldIBH signal on MQL5, so you can watch it on a real account before you buy. Historical test results are shown below with their settings and costs; they are not forecasts. Also available for MetaTrader 5: GoldIBH MT5 - h
Gold Momentum Breakout is a fully automated momentum Expert Advisor for XAUUSD. It stays out of the market until gold shows real momentum, then joins the move - long or short. Every order carries a stop loss from the first second, trades are time-limited, and there is never more than one position open. No martingale, no grid. This is the same EA that trades the Gold Momentum Breakout signal on MQL5, so you can watch it on a real account before you buy. Historical test results are shown below wit
GoldSwing T24 MT5
Thanh Trung Tran
GoldSwing T24 MT5 is a fully automated trend Expert Advisor for XAUUSD on MetaTrader 5. It trades only with the prevailing trend and closes every trade within 24 hours at the latest - no position is left open for long. A stop loss and take profit on every order, plus break-even protection after the first move. The same trading rules run the GoldSwing T24 signal on MQL5, so you can watch the strategy on a real account before you buy. Historical test results are shown below with their settings and
Gold Momentum Breakout MT5 is a fully automated momentum Expert Advisor for XAUUSD on MetaTrader 5. It stays out of the market until gold shows real momentum, then joins the move - long or short. Every order carries a stop loss from the first second, trades are time-limited, and there is never more than one position open. No martingale, no grid. The same trading rules run the Gold Momentum Breakout signal on MQL5, so you can watch the strategy on a real account before you buy. Historical test re
GoldIBH MT5
Thanh Trung Tran
GoldIBH MT5 combines three complementary gold strategies in one MetaTrader 5 Expert Advisor. Each one looks for a different market situation and manages its own position and stop loss, so the EA can find opportunities in more conditions than a single-rule EA. The same trading rules run the GoldIBH signal on MQL5, so you can watch the strategy on a real account before you buy. Historical test results are shown below with their settings and costs; they are not forecasts. Also available for MetaTra
Gold Entry MT5
Thanh Trung Tran
Gold Entry MT5 runs two independent trend systems for XAUUSD in one MetaTrader 5 Expert Advisor. Each system reads the market in its own way and manages its own position, so the EA does not depend on a single rule. A stop loss on every order and at most one position per system. The same trading rules run the Gold Entry signal on MQL5, so you can watch the strategy on a real account before you buy. Historical test results are shown below with their settings and costs; they are not forecasts. Also
A line-by-line MQL5 port of "UT Bot Alerts" by QuantNomad (Pine v4, 2020). The idea is by HPotter and the first version by Yo_adriiiiaan. The original is published as open source on TradingView. All credit goes to those authors. Also available for MetaTrader 4 (free): https://www.mql5.com/en/market/product/203726 Same logic as the original: ATR is atr(c) = Wilder RMA seeded with an SMA. The built-in iATR is not used. Trailing stop follows the original nested iff / nz recursion: it ratchets up wh
FREE
A line-by-line MQL5 port of "Range Filter Buy and Sell 5min" : the original Range Filter by DonovanWall , the simplified version by guikroth and the Pine v5 update by tvenn . It is published as open source on TradingView. All credit goes to those authors. Also available for MetaTrader 4 (free): https://www.mql5.com/en/market/product/203727 Same logic as the original: Smoothed range = EMA(EMA(|close - close[1]|, period), 2 x period - 1) x multiplier. Each EMA is seeded with an SMA, the same as ta
FREE
A line-by-line MQL5 port of "Chandelier Exit" , (c) 2019-present Alex Orekhov ( everget ), distributed under the GPL-3.0 license. The original is published on TradingView. This port is released under the same license. Also available for MetaTrader 4 (free): https://www.mql5.com/en/market/product/203729 Same logic as the original: ATR = multiplier x ta.atr(length) (Wilder RMA, seeded with an SMA). Long stop = highest(close or high, length) - ATR. It only moves up while the previous close stays ab
FREE
A backtest looks great. Then the EA runs live and the numbers are different, and nobody can say why. Was it slippage, missed signals, a restart or a manual trade? Or was the backtest flattering? Tester vs Live Trade Matcher answers that trade by trade, on MetaTrader 5. It never opens, modifies or closes orders. Also available for MetaTrader 4 (free): https://www.mql5.com/en/market/product/203730 What you get: Verdict: green (live matches the backtest), amber (partly matches) or red (live differs
FREE
Filtro:
Sem comentários
Responder ao comentário