Supertrend
Supertrend draws a band a fixed multiple of ATR away from the midpoint of each bar, lets it trail in one direction only, and flips sides when price closes through it. MetaTrader 5 does not ship it — there is no iSupertrend — so what you get depends entirely on whose implementation you are running. This page documents the one the Builder generates.
- ATR period
- 10
- ATR factor
- 3.0
- Node output
- +1 / −1
Ilustratif — data sintetis, bukan kutipan langsung.
What Supertrend tells you
Take the midpoint of a bar, measure a fixed multiple of ATR above and below it, and you have two bands that move with volatility. Supertrend makes them one-way: the upper band may only be lowered and the lower band may only be raised, until a close breaks through and the band resets to where the raw calculation puts it. Whichever band is currently active tells you the trend, and price closing through it flips the state. The result is a step-like line that hugs price during a move and stays put during a pullback, which is why it reads as a stop as much as a signal.
- The active band is the trend: below price means up, above price means down
- The band never widens against you within a trend — only tightens
- A flip is a single, unambiguous event, which is why it is what the template trades
- 1 hl2 = (high + low) / 2, and ATR over the chosen period
- 2 Upper = hl2 + factor × ATR, lower = hl2 − factor × ATR
- 3 Trail each band one way only; flip the trend when a close breaks through
Tampilkan rumus & detail perhitungan
Supertrend is two bands and a rule about which one is allowed to move:
hl2 = (high + low) / 2upper = hl2 + factor × ATR,lower = hl2 − factor × ATR- The upper band may only move down, and the lower band may only move up — unless the previous close broke through it, in which case that band resets to the raw value
- The trend flips to −1 when a close falls under the trailing lower band, and back to +1 when a close rises over the trailing upper one
Step three is the whole indicator. Without it the two bands would simply follow volatility up and down and never say anything about direction. With it, the active band ratchets toward price during a move and refuses to give ground during a pullback, so the moment price does close through it, something has actually changed.
There is no iSupertrend. MetaTrader 5 does not ship this indicator, and MQL5 has no function for it. What the Builder generates creates exactly one MT5 handle — iATR(symbol, timeframe, period) — and computes everything else in the EA from CopyHigh, CopyLow and CopyClose. That has a consequence worth stating before any setting is discussed: Supertrend has no canonical definition. Implementations differ over whether to centre on hl2 or the close, whether to test the flip against the close or the bar’s extremes, and how the band behaves after a break. Two of them, both labelled 10 and 3.0, can flip on different bars.
Two things follow for anyone building with it.
The node returns the trend, not the band. Its output is +1 or −1. That is unusual here, and it is convenient: since the Builder’s indicator nodes also publish the previous bar’s value, a Cross against a Constant of 0 is precisely “the trend just changed sign”, and the whole flip template needs one indicator node. It also means the band’s price is not available to place a stop at — the template uses an ATR trail at the same width instead.
The recursion is replayed, not stored. Because each band value depends on the one before it, the generated EA folds several hundred bars of the calculation on every tick rather than reading a buffer. The fold is self-correcting, so a fixed window converges to the same answer a stateful implementation would give — the Builder’s note records a warmup of 100 or more matching a reference implementation on all five test conditions, and the default is 300. The cost is real CPU per tick, and the warmup input is where you trade one against the other.
Sinyal
Sinyal yang dapat di-backtest dari Supertrend — dan kondisi pasar yang cocok untuk masing-masing.
Trend as a Filter
Siap di BuilderThe Band as a Stop
Siap di BuilderFlip Clustering
Logika lanjutanImplementasi MT5
Apa yang benar-benar dihitung dan digambar MetaTrader 5 — acuan bagi setiap aturan di halaman ini.
Buffer
| Indeks | Buffer | Digambar di MT5 sebagai | Isinya |
|---|---|---|---|
| 0 | MAIN_LINE | Line | There is no Supertrend buffer to read, because there is no Supertrend indicator in MT5. The only handle the generated EA creates is iATR, and index 0 of that is the ATR the band width is built from. The band and the trend are computed in the EA itself. |
Catatan platform
Bekerja paling baik / gunakan dengan hati-hati
Tidak ada indikator yang merupakan keunggulan universal. Inilah di mana Supertrend membantu — dan di mana ia menyesatkan.
Bekerja paling baik
- Markets that trend for long enough that one flip covers many bars
- As a direction filter for an entry rule that has its own timing
- Higher timeframes, where a flip is rarer and each one means more
- Paired with an ATR exit, so the entry and the stop are measured with the same width
Gunakan dengan hati-hati
- Ranges — the band sits close to price and flips repeatedly, each flip a full reversal
- Comparing settings against someone else's Supertrend; the implementations genuinely differ
- Small factors, which trade the noise the band was supposed to absorb
- Assuming the flip bar is where the trend started; it is where the close finally broke through
Buat strategi Supertrend
Hubungkan sinyal ke aturan masuk dan keluar, lalu ekspor EA MT5 yang dapat dikompilasi — tanpa kode.
- One Supertrend node — period 10, factor 3, warmup 300
- A Constant of 0 for the trend to be crossed against
- Crossover of the trend over zero → Open Buy · SL 60 / TP 180
- Crossunder → Open Sell
- Stop then trails at the same volatility width the trend itself uses
Gabungkan Supertrend dengan indikator lain
Satu indikator jarang berdiri sendiri. Kombinasi ini menutupi titik buta Supertrend.
Supertrend + ADX
- ADX above 25
- Supertrend flips up
- Buy
No single-flow template combines them. Start from Supertrend Flip and add an ADX node with a Compare at 25, joined to the Cross with an And gate — the same filter the Parabolic SAR template uses.
Buka Builder →Supertrend + ATR
- ATR above its own recent level
- Supertrend flips up
- Buy
No single-flow template pairs them explicitly, though the template's trailing stop already uses ATR(10). Add two ATR nodes at different shifts with a Compare between them to require the width to be expanding.
Buka Builder →Supertrend + Parabolic SAR
- SAR below price
- Supertrend is +1
- Buy
No single-flow template pairs them. Start from Supertrend Flip and add a SAR node with a Price node into a Compare, joined with an And gate.
Buka Builder →Supertrend + Heikin-Ashi
- Supertrend is +1
- HA close crosses above HA open
- Buy
No single-flow template pairs them. Start from Supertrend Flip, add two Heikin-Ashi nodes — one on HACLOSE, one on HAOPEN — into a Cross, and join that to the existing condition with an And gate.
Buka Builder →Parameter
Nilai awal untuk divalidasi pada pasangan dan timeframe Anda sendiri — bukan pengaturan yang dijamin.
| Parameter | Default | Rentang uji yang disarankan | Fungsinya |
|---|---|---|---|
| ATR period | 10 | 1–999 | The averaging length of the ATR the band width is built from. Shorter makes the band react to the last few bars and flip more often; longer makes it a slower, wider channel. It is passed straight to iATR in the generated code. |
| ATR factor | 3.0 | 0.1–100 | How many ATRs away from the bar's midpoint the band sits. This is the setting that decides everything about the indicator's character — at 1 it is a tight stop that flips constantly, at 5 it is a wide channel that rarely does. Most published Supertrend settings pair a factor of 3 with a period of 10, which is the node's default. |
| Warmup bars | 300 | 50–5000 | How many bars back the generated EA folds the band recursion from. The band depends on its own previous value, so a value has to be built up rather than read; the recursion is self-correcting, so it converges. The Builder's own note records that a warmup of 100 or more matched a reference implementation exactly on every one of five test conditions. Higher is stricter and slower — the loop runs every tick. |
| Shift | 0 | 0–30 | Which bar back the trend is reported for. The node also publishes the previous bar's trend automatically, which is what makes a single node enough to detect a flip. |
Preset awal
Contoh pasar
Di mana Supertrend bekerja, di mana ia gagal, dan bagaimana filter mengubah hasilnya.
A flip that started a run
Price closes above the trailing upper band after a decline and the trend turns +1. The band steps up under price for the next twenty bars and the ATR trail follows it until the target is reached.
Flips inside a range
A quiet session where the band sits close to price and the trend changes sign three times in six bars. Each flip is a valid signal and each one reverses the previous entry.
The flip a trend filter would refuse
The trend turns up on a single wide bar while the market has been going sideways for days. Supertrend has no opinion about that; ADX below 25 does, which is why the combination above exists.
FAQ
- Is Supertrend built into MetaTrader 5?
- No. There is no iSupertrend function in MQL5 and nothing called Supertrend in the Navigator. Every Supertrend you see on an MT5 chart is a custom indicator someone wrote, and the versions differ in real ways — which price the band is centred on, what the flip is tested against, how the band resets after a break. The Builder computes it inside the generated EA from an ATR handle, and this page documents that calculation rather than a platform function.
- What does the node actually return?
- The trend, as +1 or −1 — not the band's price. That is why the template compares it against a Constant of 0: crossing zero is the flip. It also means you cannot use the node to place a stop at the band, because the band's level is not exposed.
- What settings should I use?
- An ATR period of 10 with a factor of 3.0 is the most widely published pair and the node's default. The factor matters far more than the period: it sets how much room the band gives price before conceding a reversal. Below about 2 the indicator becomes a tight stop that flips on noise; above about 4 it rarely flips at all. Bear in mind that settings quoted elsewhere belong to whichever implementation that author used.
- What is the warmup setting for?
- The band depends on its own previous value, so it cannot be read at one bar — it has to be built up. The generated EA replays the calculation from this many bars back on every tick. The recursion corrects itself, so it converges: the Builder's own note records that 100 bars or more reproduced a reference implementation exactly on all five of its test conditions, and the default is 300. Raising it costs CPU on every tick; lowering it below convergence changes the answer.
- Can I build a Supertrend EA without coding?
- Yes. The Supertrend Flip template uses one Supertrend node and one Constant of 0, crosses them in both directions, and opens on the bar the trend changed sign. The stop then trails at 3 × ATR(10) — the same width the band itself uses. The ATR period, the factor, the warmup depth and the stop distances are all EA inputs.
- How should I validate settings before going live?
- Backtest on quality tick data, then run on a demo account before risking money. Two things are specific to this indicator. First, since every flip is a reversal, the trade count is high and the result is dominated by how much of the sample was trending — hold back a stretch that includes a long range, not just the trend you noticed. Second, if you are comparing against a published Supertrend result, confirm the other implementation matches this one before concluding a setting is wrong.
Artikel terkait
Glossary