SuperTrend EA for MT5 — No Code
Can I build a SuperTrend EA for MT5 without coding?
Not in AlfaTactix today. SuperTrend is not one of the indicators the MT5 Strategy Builder supports, so you cannot add it as a Step 3 condition. You have two honest paths:
- Code it in MQL5 — compute the bands from ATR in your EA, or read a SuperTrend indicator from the MQL5 Code Base (outline below).
- Build a no-code trend EA with supported indicators — for example an EMA or SMA crossover with the ATR volatility filter on Step 4. It follows trends too, but it is a different rule and will not reproduce SuperTrend signals.
Disclosure: This is an educational guide, not financial advice. Backtest and Demo results do not guarantee live profits.
Related guides: SuperTrend Indicator (academy) · Build EA Without Coding · MA Crossover EA — No Code · Backtest in Strategy Tester · EA Strategy Library
What Is a SuperTrend EA?
A SuperTrend Expert Advisor automates a well-known trend-following rule:
| Signal | Rule (typical) |
|---|---|
| Buy (long) | Price flips above the Supertrend line — uptrend / Direction Up |
| Sell (short) | Price flips below the line — downtrend / Direction Down |
Supertrend uses ATR to place a dynamic band; the line switches between upper and lower bands when price closes through the band. In MQL5, an EA's logic runs inside OnTick() [1]; MetaTrader 5 has no built-in SuperTrend function, so the EA computes the bands from ATR itself or reads a custom indicator.
Why traders search for this: Clear trend signals without coding ATR math. Most tutorials show Pine or MQL5 code. This guide explains the rule, what it takes in MQL5, and the closest no-code path in AlfaTactix today.
Classic Settings and When It Works
| Setting | Starter value | Notes |
|---|---|---|
| ATR Period | 10 | Common default |
| Multiplier | 3 | Common default; higher = wider band, fewer flips |
| Band centre | Median (High + Low) / 2 | Classic formula; some versions use Close |
| Timeframe | M15 or H1 | M5 = more signals; H4 = slower |
| Symbol | EURUSD, GBPUSD | Lower spread helps trend systems |
| Confirmation | 1–2 closed bars | Reduces one-bar noise after a flip |
Works best: Clear trends, liquid sessions (London / New York overlap).
Struggles in: Tight ranges — repeated flips (whipsaw). Mitigate with a session or spread filter and a stop loss.
For indicator theory and limitations, see SuperTrend Indicator — Settings & Entries.
SuperTrend Logic in MQL5
Without a built-in function, a hand-written EA follows these steps on each new closed bar:
- Create one ATR handle with iATR [2] in OnInit and read the last closed value with CopyBuffer [3].
- Compute the basic bands: mid = (High + Low) / 2; upper = mid + Multiplier × ATR; lower = mid − Multiplier × ATR.
- Ratchet them: in an uptrend the lower band may only rise; in a downtrend the upper band may only fall.
- Flip the direction up when Close breaks above the previous upper band, and down when Close breaks below the previous lower band. A flip is your entry signal.
// OnInit
atrHandle = iATR(_Symbol, PERIOD_M15, 10);
// OnTick, once per new bar
CopyBuffer(atrHandle, 0, 1, 1, atr); // ATR of the last closed bar
double mid = (high[1] + low[1]) / 2.0;
double upper = mid + 3.0 * atr[0];
double lower = mid - 3.0 * atr[0];
// ratchet the bands, then compare close[1] with the previous bands to detect a flip
Alternative: download a SuperTrend indicator from the MQL5 Code Base [4] and read it with iCustom(). Check which buffer holds the line and which holds the direction before you trade on it.
A No-Code Trend EA With Supported Indicators
If you want an Expert Advisor without writing MQL5, the MT5 form supports the market's most-used indicators: RSI, SMA, EMA, WMA, MACD, Stochastic, Williams %R, CCI, Momentum, Bollinger Bands, ATR, Volume and OBV. The closest trend-following idea is:
| Step | Setting |
|---|---|
| Step 3 — Signals | EMA or SMA crossover: fast above slow for Buy, below for Sell |
| Step 4 — Filters | ATR volatility filter; optional market session (London / New York) and spread filter |
| Step 5 — Risk | ATR-based stop loss, fixed lot or risk % |
Full walkthrough: MA Crossover EA — No Code. This is not a SuperTrend EA; compare both in the Strategy Tester before choosing.
Trader-Reported Themes (Forums)
Educational summary — not quotes from individuals.
In public threads on r/algotrading and r/Forex, traders often report similar themes about trend-following tools such as Supertrend:
- Whipsaw in ranges — multiple small losses when price chops around the line
- Session matters — filtering to London / New York overlap is a common mitigation
- Backtest vs live — spread and slippage change results; validate on Demo (Strategy Tester vs Live)
- Not a holy grail — combination with risk limits and filters beats “set and forget”
We do not attribute profitability to any influencer “secret” strategy. Validate on your broker and symbol.
Compile and Backtest
- Put your
.mq5inMQL5/Experts(hand-written, or exported from Code Generator for the supported-indicator version) and compile (F7) in MetaEditor [5]. - Strategy Tester: Every tick, realistic spread, 6–12 months.
- Demo before live. Read Strategy Tester vs Live.
Error 10016: Invalid Stops.
Improvements: Filters and Risk
| Problem | Lever |
|---|---|
| Whipsaw in range | Wait 2–3 closed bars after a flip; trade only London / New York; higher Multiplier |
| Late entries | Lower Multiplier or shorter ATR Period (more noise) |
| Spread cost | Skip entries when the spread is above your limit |
| Stop placement | ATR-based stop sized to the same ATR the bands use |
Tactix AI on this workflow
AlfaTactix includes Tactix AI: use Tactix Studio to describe your idea in plain language and draft timeframes, signals, filters, and risk into the same six-step Strategy Builder form — or open Tactix Guide on any step when you only need a field explained. Review every value, then export MQL5 or Pine Script from Code Generator (form-first — not untested prompt-to-code).
Next Steps
- SuperTrend Indicator guide — settings and signal logic
- MA Crossover EA — No Code — a trend EA you can build today with supported indicators
- Scalping EA concepts · Scalping EA — No Code — faster timeframe build
- Build EA Without Coding — full six-step tour
- Production-Ready MQL5 Without MetaEditor
References: Investopedia — SuperTrend [6] · TradingView SuperTrend [7] · MetaTrader 5 Strategy Tester [8].

