SuperTrend EA MT5 — No Code

SuperTrend EA for MT5: classic ATR 10 / multiplier 3 settings, the band logic in MQL5, and a no-code trend alternative with supported indicators.

📖 6 min read

📝 1,194 words

🏷️ MQL5 and Expert Advisors

Share this article:

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:

  1. Code it in MQL5 — compute the bands from ATR in your EA, or read a SuperTrend indicator from the MQL5 Code Base (outline below).
  2. 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:

SignalRule (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

SettingStarter valueNotes
ATR Period10Common default
Multiplier3Common default; higher = wider band, fewer flips
Band centreMedian (High + Low) / 2Classic formula; some versions use Close
TimeframeM15 or H1M5 = more signals; H4 = slower
SymbolEURUSD, GBPUSDLower spread helps trend systems
Confirmation1–2 closed barsReduces 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:

  1. Create one ATR handle with iATR [2] in OnInit and read the last closed value with CopyBuffer [3].
  2. Compute the basic bands: mid = (High + Low) / 2; upper = mid + Multiplier × ATR; lower = mid − Multiplier × ATR.
  3. Ratchet them: in an uptrend the lower band may only rise; in a downtrend the upper band may only fall.
  4. 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:

StepSetting
Step 3 — SignalsEMA or SMA crossover: fast above slow for Buy, below for Sell
Step 4 — FiltersATR volatility filter; optional market session (London / New York) and spread filter
Step 5 — RiskATR-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

  1. Put your .mq5 in MQL5/Experts (hand-written, or exported from Code Generator for the supported-indicator version) and compile (F7) in MetaEditor [5].
  2. Strategy Tester: Every tick, realistic spread, 6–12 months.
  3. Demo before live. Read Strategy Tester vs Live.

Error 10016: Invalid Stops.


Improvements: Filters and Risk

ProblemLever
Whipsaw in rangeWait 2–3 closed bars after a flip; trade only London / New York; higher Multiplier
Late entriesLower Multiplier or shorter ATR Period (more noise)
Spread costSkip entries when the spread is above your limit
Stop placementATR-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

References: Investopedia — SuperTrend [6] · TradingView SuperTrend [7] · MetaTrader 5 Strategy Tester [8].

Frequently Asked Questions

Not in AlfaTactix today. SuperTrend is not one of the indicators the MT5 Strategy Builder supports, so you cannot add it on Step 3. You can code it in MQL5 (bands from iATR, or a Code Base indicator read with iCustom), or build a no-code trend EA with supported indicators such as an EMA or SMA crossover with an ATR volatility filter.

Common starters: ATR Period 10, Multiplier 3 on M15 or H1 for forex majors. Higher multiplier (3.5–4) means fewer flips; lower ATR period reacts faster. Always backtest on your symbol and broker spread.

No. MT5 has no built-in SuperTrend function. An EA either computes the bands from an iATR handle or reads a custom SuperTrend indicator from the MQL5 Code Base with iCustom.

No. SuperTrend is a trend-following rule set. It often whipsaws in sideways markets. This guide is educational: backtest, then Demo, then live only with risk you can afford.

See the AlfaTactix SuperTrend indicator guide at /academy/indicators/supertrend for ATR-based bands and signal intuition, then return here for the MQL5 outline.

The MT5 form supports RSI, SMA, EMA, WMA, MACD, Stochastic, Williams %R, CCI, Momentum, Bollinger Bands, ATR, Volume and OBV. You export the .mq5 from Code Generator and compile it once (F7) in MetaEditor.

References

  1. MetaQuotes, MQL5 Reference. OnTick. https://www.mql5.com/en/docs/event_handlers/ontick
  2. MetaQuotes, MQL5 Reference. iATR. https://www.mql5.com/en/docs/indicators/iatr
  3. MetaQuotes, MQL5 Reference. CopyBuffer. https://www.mql5.com/en/docs/series/copybuffer
  4. MQL5.community. MQL4 and MQL5 Source Code Library. https://www.mql5.com/en/code
  5. MetaQuotes, MetaEditor Help. Welcome to algorithmic trading!. https://www.metatrader5.com/en/metaeditor/help
  6. Investopedia. Mastering Trend Analysis with the Supertrend Indicator. https://www.investopedia.com/supertrend-indicator-7976167
  7. TradingView. Supertrend. https://www.tradingview.com/support/solutions/43000634738-supertrend/
  8. MetaQuotes. MetaTrader 5 Built-in Trading Strategy Tester. https://www.metatrader5.com/en/automated-trading/strategy-tester

AlfaTactix is a no-code strategy builder for MetaTrader 5 (MQL5) and TradingView (Pine Script) traders who design and manage rule-based strategies.

Trading involves substantial risk of loss. AlfaTactix generates code from the rules you define and does not provide financial advice. Past or backtested performance does not guarantee future results.

© 2026 AlfaTactix. All rights reserved.