On this page
Back to tutorials

SuperTrend EA MT5 — No Code

Build a SuperTrend flip EA: ATR 10, multiplier 3, Cross Up/Down on Step 3, all six condition types, session filter, export MQL5, Every tick backtest.

📖 16 min read

📝 3,100 words

🏷️ MQL5 & Expert Advisors

Share this article:

Want to build a no-code strategy right now?

Create your free account in seconds and start building immediately.


SuperTrend EA for MT5 — No Code

Quick Answer: SuperTrend EA Without Code

Quick answer: Add Supertrend on Step 3 — Signals in AlfaTactix Strategy Builder. On Buy, add condition CrossDirection Up (timeframe M15 or H1, Confirmation 1–2). On Sell, CrossDirection Down. Set indicator ATR Period 10, Multiplier 3, Source Close (product defaults). Add Stop Loss on Step 5, Save, export MQL5 from Code Generator, compile once in MetaEditor, backtest EURUSD M15 with Every tick in the Strategy Tester.

Disclosure: This is an educational build 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


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, execution still runs inside OnTick(); in Strategy Builder you define when entries fire — the export handles indicator handles and buffers.

Why traders search for this: Clear trend signals without coding ATR math. Most tutorials show Pine or MQL5 code. This guide maps the same idea to every parameter and condition Supertrend exposes in AlfaTactix.


Classic Settings and When It Works

SettingStarter valueNotes
ATR Period10Default in builder (range 1–100)
Multiplier3Default; higher = wider band, fewer flips
SourceCloseAlso: High, Low, Typical, Median
TimeframeM15 or H1M5 = more signals; H4 = slower
SymbolEURUSD, GBPUSDLower spread helps trend systems
Confirmation1–2 barsReduces one-bar noise on Cross

Works best: Clear trends, liquid sessions (London / New York overlap).

Struggles in: Tight ranges — repeated flips (whipsaw). Mitigate with Step 4 session or spread filters and Step 5 stop loss.

For indicator theory and limitations, see SuperTrend Indicator — Settings & Entries.


Supertrend Parameters in Strategy Builder

On Step 3 — Signals, add indicator Supertrend (Trend group). The Parameters panel shows:

ParameterTypeRange / optionsDefaultWhat it does
ATR PeriodNumber1 – 10010Lookback for Average True Range
MultiplierNumber> 0 (step 0.1)3Scales distance of bands from mid-price
SourceSelectClose, High, Low, Typical, MedianClosePrice input for calculations

Tip: Keep exported parameters aligned with your Cross timeframe tab (e.g. tf0 = M15 on Buy/Sell rules).


Supertrend Condition Types Explained

Open Supertrend on Step 3 → Add condition. The product exposes six condition types:

FieldOptionsDefault
DirectionUp · DownUp
Timeframe1m … 1M (full list in UI)1d
Confirmation1 – 10 bars1

Use for this guide: Buy = Cross Up on your trading TF (e.g. M15). Sell = Cross Down on the same TF.


2. Trend Direction

FieldOptionsDefault
DirectionUp · DownUp
Timeframe1m … 1M1d

Use case: “Only buy when Supertrend is already Up” — fewer entries than Cross; good as a filter combined with another signal (AND).


3. Breakout

FieldRangeDefault
DirectionUp · DownUp
ThresholdNumber (step 0.01)0.01
Period1 – 10010
Confirmation1 – 101

Use case: Breakout-style distance from the line — advanced; test in Strategy Tester before live.


4. Pullback

FieldRangeDefault
DirectionUp · DownUp
Thresholdstep 0.010.01
Confirmation1 – 101

Use case: Enter on pullback toward the line in an established trend.


5. Range Breakout

Same fields as Breakout (Direction, Threshold, Period, Confirmation).


6. Multi-Timeframe Confirm

FieldOptionsDefault
TimeframesMultiselect 1m … 1M1d
Confirmation1 – 101

Use case: Require Supertrend alignment on e.g. H1 and M15 before entry. See also Advanced EA MTF & Filters.


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.


Build the SuperTrend EA Step by Step

Workflow: six steps in Strategy Builder demo.

Step 1 — Strategy information

  • Name: e.g. Supertrend M15 EURUSD
  • Description: optional

Step 2 — Timeframes

  • Enable M15 (or H1) as the trading timeframe for Step 3 tabs.

Step 3 — Signals (core)

  1. Tab Buy → timeframe M15.
  2. Add indicatorSupertrend.
  3. Parameters: ATR Period 10, Multiplier 3, Source Close.
  4. Add conditionCross → Direction Up, Timeframe M15, Confirmation 2.
  5. Tab Sell → same indicator settings.
  6. Add conditionCross → Direction Down, Timeframe M15, Confirmation 2.

Optional: Add Trend Direction Up on Buy with AND if you want entries only when already in uptrend (stricter).

Step 4 — Filters (optional)

  • Market Session → condition isActive → sessions London, New York (Advanced MTF & Filters)
  • Liquidity FiltershasSpreadmaxSpread e.g. 0.01 (≈ 1 pip decimal for EURUSD — adjust per broker)

Step 5 — Risk management

SettingSuggestion
Lot / risk %0.01 Demo or 0.5–1% risk
Stop LossFixed pips or ATR-based
Take ProfitOptional; many Supertrend EAs exit on opposite Cross
One positionAvoid overlapping entries

See EA Risk Management.

Step 6 — Preview and Save

Review Buy/Sell rules → Save.


Export, Compile, and Backtest

  1. Code Generator → saved strategy → MQL5 → download .mq5.
  2. Copy to MQL5/Experts, compile (F7) in MetaEditor.
  3. Strategy Tester: Every tick, realistic spread, 6–12 months.
  4. Demo before live. Read Strategy Tester vs Live.

Error 10016: Invalid Stops.


Improvements: Filters and Risk

ProblemBuilder lever
Whipsaw in rangeConfirmation 2–3; Step 4 session filter; higher Multiplier
Late entriesLower Multiplier or shorter ATR Period (more noise)
Spread costStep 4 hasSpread / liquidity filter
Trend qualityMulti-Timeframe Confirm H1 + M15

Next Steps

Try it: Strategy Builder demo — build the Supertrend Cross EA, export, and backtest in one session.

References: Investopedia — SuperTrend · TradingView SuperTrend · MetaTrader 5 Strategy Tester.

Build your no-code trading strategy now — free

Create your account and start building a complete no-code strategy right now. Add indicators, filters, and risk rules, then export MQL5 in minutes.

Frequently Asked Questions

Yes. Add Supertrend on Step 3 in AlfaTactix Strategy Builder, use Cross Direction Up for Buy and Down for Sell (ATR Period 10, Multiplier 3 defaults), set risk on Step 5, save, export MQL5 from Code Generator, compile once in MetaEditor, and backtest with Every tick in the Strategy Tester.

Common starters: ATR Period 10, Multiplier 3, Source Close 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.

Cross fires when the Supertrend line flips (Direction Up or Down) with optional Confirmation bars. Trend Direction checks whether the indicator is already in an uptrend or downtrend on the selected timeframe without requiring a fresh flip.

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 no-code EA build.

You export .mq5 from Code Generator and compile once (F7). You do not hand-write Supertrend math. See Production-Ready MQL5 Without MetaEditor on the MQL5 EA academy hub.

Build your no-code strategy now — free

Create Free Account