SuperTrend AI Clustering EA
- Uzmanlar
-
Michael Prescott Burney
Merhaba, ben Michael P. Burney. Yüksek performanslı algoritmik işlem sistemleri konusunda uzmanlaşmış profesyonel bir trader, trading koçu ve Expert Advisor (EA) geliştiricisiyim. Yıllar süren gerçek piyasa deneyimiyle değerli metaller piyasasında kendimi kanıtladım; zararlar, düşüş dönemleri ve - Sürüm: 777.0
- Etkinleştirmeler: 5
SuperTrend AI Clustering Expert Advisor for MetaTrader 5
SuperTrend AI Clustering is an adaptive trend-following Expert Advisor for MetaTrader 5 designed to adjust itself to changing market conditions. Instead of using one fixed SuperTrend multiplier, the EA evaluates multiple factor values at the same time, measures their recent performance, applies K-Means clustering, and selects the factor group that is currently performing best. This creates a dynamic SuperTrend model that can respond to different volatility regimes and market structures without requiring constant manual reconfiguration.
The system is built for traders who want an automated approach to trend-following with a strong focus on adaptability, structured risk control, and transparent on-chart information. It can be used on forex pairs, metals, indices, cryptocurrencies, commodities, and other symbols available in MetaTrader 5. The Expert Advisor is compatible with multiple timeframes, from lower-timeframe intraday trading to higher-timeframe swing and position trading.
Core Trading Concept
The logic of the EA begins with the SuperTrend indicator, which uses ATR-based volatility bands to identify bullish and bearish market phases. A lower factor creates tighter bands and faster reactions, while a higher factor creates wider bands and slower but more selective signals. The main challenge with a traditional SuperTrend is that one fixed factor rarely performs well in all market conditions.
To solve this, SuperTrend AI Clustering calculates a full range of SuperTrend variations using user-defined factor values. Each variation is tracked with a performance score that reflects how effectively that factor has aligned with recent price movement. These performance scores are then processed through a K-Means clustering model, which separates them into three groups representing weaker, average, and stronger recent performance.
The EA then selects the target cluster and calculates an adaptive factor from that group. This adaptive factor drives the final SuperTrend used for trade logic, trailing behavior, and dashboard display. In practical terms, the Expert Advisor is always trying to work with the SuperTrend sensitivity that best matches the current market environment.
Performance Index and Adaptive AMA
In addition to adaptive factor selection, the EA includes a Performance Index that reflects the confidence level of the selected cluster relative to recent price movement. This value can be used as a quality filter so the system only opens trades when market conditions meet a minimum confidence threshold. Traders who want more selective entries can raise this filter, while those who want more activity can keep it lower or disable it.
The EA also calculates an Adaptive Moving Average based on the selected SuperTrend trailing stop. The smoothing speed of this AMA changes according to the Performance Index. When confidence is strong, the AMA responds more quickly. When conditions become uncertain, it smooths more aggressively and helps reduce noise. This line can be used as an additional entry filter and as an optional exit trigger.
Main Features
- Adaptive SuperTrend factor selection based on K-Means clustering.
- Real-time performance tracking across a configurable factor range.
- Performance Index filter for confidence-based trade selection.
- Adaptive Moving Average confirmation and optional AMA-based exits.
- Support for fixed stop loss, ATR-based stop loss, SuperTrend trailing, break-even, and partial close logic.
- Built-in spread filter, ATR filter, time filter, position limit, daily loss control, and drawdown protection.
- Fixed lot, risk-based lot sizing, and balance-based lot sizing modes.
- Optional lot progression after wins or losses with a maximum safety cap.
- On-chart dashboard with trend state, factor data, cluster information, trailing stop, AMA value, and performance metrics.
- Ready-to-use preset files for common trading styles and timeframes.
Entry Logic
The EA can be configured to trade in several ways depending on how selective you want the execution process to be. The standard mode uses SuperTrend signal changes. A stricter mode requires both a SuperTrend signal and AMA confirmation. There is also an AMA-only mode for traders who prefer a smoother trigger model.
Additional entry filters include a minimum Performance Index threshold, a minimum ATR requirement, and a maximum spread filter. These controls help reduce entries during low-volatility periods, unstable market conditions, or high transaction-cost environments.
Exit Logic
Exit handling is flexible and designed for both reactive and protective trade management. Positions can be closed on an opposite SuperTrend signal, on an opposite AMA cross, or by a trailing stop that follows the adaptive SuperTrend line. Fixed stop loss and take profit levels can also be used, or replaced with ATR-based distances for more dynamic trade management.
The EA also supports break-even movement, partial closing at a defined profit distance, forced trade closure after a specific number of bars, and end-of-day closing for traders who do not want overnight exposure. These controls make it possible to configure the system for scalping, intraday, swing, or longer-term trend-following workflows.
Risk and Money Management
SuperTrend AI Clustering includes a full risk management layer so the trading model can be adapted to different account sizes and risk preferences. Position sizing can be based on a fixed lot value, a percentage of account balance, or a balance-based method linked to margin usage. Traders can define stop parameters manually or allow the EA to derive them from ATR and SuperTrend structure.
The EA also includes maximum simultaneous position limits, maximum daily loss control, and maximum drawdown protection. These tools are especially useful for traders who want stricter discipline or who need to operate within external risk limits. Optional lot progression after winning or losing trades is available, but it should be used carefully and only with appropriate drawdown controls.
Time and Session Control
The built-in time filter allows trading to be restricted to specific hours and weekdays using broker server time. This is useful for traders who want to focus on active sessions such as London or New York, avoid low-liquidity periods, or reduce exposure during specific days. Overnight session handling is also supported.
For lower-timeframe strategies, session filtering can help reduce noise and concentrate activity into periods with stronger movement. For higher-timeframe strategies, the filter can be disabled so the EA can monitor the market continuously.
Visual Dashboard
When enabled, the chart dashboard provides a clear view of the internal state of the algorithm. It displays the selected cluster, the current adaptive factor, the Performance Index, the active trend direction, the trailing stop price, the AMA value, and cluster size information. This helps traders understand what the EA is seeing in real time instead of treating it as a black-box system.
The adaptive SuperTrend line, AMA line, and signal arrows can also be shown directly on the chart. This visual layer makes it easier to review entries and exits, evaluate market structure, and compare system behavior across symbols and timeframes.
Preset Files and Optimization
The package includes preset files prepared for common trading styles such as M1 scalping, M5 fast intraday trading, M15 balanced intraday trading, M30 intraday swing, H1 swing trading, and H4 position trading. These presets are intended as structured starting points rather than final settings for all brokers and symbols.
For best results, each preset should be tested and optimized in the MetaTrader 5 Strategy Tester for the target symbol, broker conditions, and timeframe. A staged optimization approach is recommended, beginning with the core algorithm settings such as ATR length, factor range, and performance memory, and then moving to entry filters, exits, and session controls.
Best Use Cases
This Expert Advisor is suitable for traders who want an adaptive trend-following framework that can be configured for different instruments and execution styles. It can be used for fast lower-timeframe trading with tighter factor ranges and shorter memory settings, or for slower swing and position trading with wider factor ranges and more stable performance memory.
It is also useful for traders who prefer structured trade management instead of a simple entry-and-exit robot. Because the system combines trend detection, confidence filtering, adaptive smoothing, and layered risk controls, it can be shaped into a more aggressive or more conservative profile depending on the selected configuration.
Important Notes
This product is developed for MetaTrader 5 and is not compatible with MetaTrader 4. The Expert Advisor is primarily designed for hedge-style account environments, although it can also run on netting accounts where position handling behaves differently.
As with any automated trading system, proper testing is essential before live use. Traders should evaluate settings on their own symbols, broker feed, spread conditions, and execution environment. A VPS may be beneficial for lower-timeframe strategies that require uninterrupted operation and lower latency.
Risk Warning
Trading foreign exchange, metals, indices, commodities, and cryptocurrencies involves substantial risk and may not be suitable for all traders. Leverage can work for or against you. Before using any automated trading system, consider your objectives, experience, and risk tolerance carefully.
Past performance does not guarantee future results. Strategy Tester results, historical analysis, and optimization reports should be treated as research tools only. Market conditions change, and all trading decisions remain the responsibility of the user.
Support
For installation help, setup questions, or product-related support, please use the MQL5 product page comments section or direct MQL5 messages. When reporting an issue, it is helpful to include your broker name, account type, symbol, timeframe, platform build, screenshots, and the settings currently being used.
