Learn › Technical analysis

Supertrend Tested: The Full Formula, Why It Looks Accurate, Where Ranges Hurt

The Supertrend formula step by step, the 10 and 3 defaults, a worked example, a test on 4 simulated markets with spread, and how to use it as a trailing stop.

Intermediate 12 min read 23 October 2026

What you will learn
  • Supertrend is (High + Low) ÷ 2 ± multiplier × ATR, ratcheted so it moves one way, flipping when price closes through it
  • It looks accurate on screenshots because the line is always on the side that just worked, and the small losses in ranges are easy to overlook
  • On simulated prices, reversing at every flip only made money in real trends, lost the spread on random walks and lost heavily in mean-reverting markets
  • It works better as a trailing stop, with a market-condition filter and a setting on a plateau, than as an entry signal

Supertrend is a trend line placed one volatility-sized distance (ATR) away from price. In an uptrend it sits below price, in a downtrend above, and it flips sides when price closes through it. On a chart it looks beautifully clean: one long green line through the rally, one long red line through the fall. Many traders take that as proof of an accurate signal. This article takes the formula apart step by step, computes a real example, then tests it on simulated prices in several market conditions, with spread, to see which part is real and which part is an optical illusion.

The Supertrend formula, step by step

Supertrend is built from two things: the middle of each bar, and ATR (Average True Range), the average bar size counting gaps. If ATR is new to you, read What ATR is first.

Step 1: basic bands, recalculated every bar

  • Mid price = (High + Low) ÷ 2
  • Basic upper band = mid price + multiplier × ATR
  • Basic lower band = mid price − multiplier × ATR

Step 2: final bands. This is what makes Supertrend different from a plain ATR envelope: the bands move one way only, like a ratchet.

  • Final lower band: take the new basic lower band if it is higher than the previous final lower band, or if the previous close was below the previous final lower band. Otherwise keep the old value.
  • Final upper band: take the new basic upper band if it is lower than the previous final upper band, or if the previous close was above the previous final upper band. Otherwise keep the old value.

In plain words: during an uptrend the lower band can only move up. It never steps back down, even if ATR widens or price dips.

Step 3: direction

  • If the previous bar was a downtrend (the line shown is the upper band) and this bar closes above the final upper band, switch to uptrend
  • If the previous bar was an uptrend (the line shown is the lower band) and this bar closes below the final lower band, switch to downtrend
  • The Supertrend line on the chart = the final lower band in an uptrend, the final upper band in a downtrend

The 10 and 3 defaults, and platform differences

The Supertrend built into TradingView uses a 10-bar ATR, a multiplier of 3, and Wilder’s ATR (the slow running average also used in RSI). Another setting you see often is 7 and 3, which puts the line slightly closer to price.

MT4 and MT5 don’t ship Supertrend in their standard indicator set, so you use a community version, and each may average ATR differently. Some use a simple average (SMA) of True Range instead of Wilder’s. The same numbers can therefore give slightly different lines, and the flip can land a bar or two apart. Before comparing results with someone else, or with an EA, check in the code which ATR it uses.

One more thing to know: Supertrend uses the close. While a bar is still open, the line can flip and flip back. Closed bars don’t change, so only count a signal once the bar has closed. More on this in Repainting indicators.

Worked example: 4 bars around a flip

These numbers come from the same simulated series as the chart below, with Supertrend 10, 3 computed using the formula above. Prices are rounded to 2 decimals and ATR to 3. Before bar 1 price is in an uptrend, the final lower band is locked at 159.55, and the previous close is 163.40.

BarHighLowCloseATRMidBasic lowerFinal lowerFinal upperDirection
1164.04162.61162.971.721163.33158.16159.55165.32Up
2163.73161.80161.801.743162.76157.54159.55165.32Up
3161.80159.42159.421.807160.61155.19159.55165.32Down
4160.32159.42159.631.717159.87154.72154.72165.02Down

Step by step:

  1. Bar 1. Basic lower = 163.33 − 3 × 1.721 = 158.16. That is below 159.55, and the previous close (163.40) is still above 159.55, so the band stays at 159.55. The close of 162.97 is above it: still an uptrend.
  2. Bar 2. Basic lower 157.54 is lower again. The final band stays at 159.55, and the close of 161.80 is still above it.
  3. Bar 3. New ATR = (1.743 × 9 + 2.38) ÷ 10 = 1.807, where 2.38 is this bar’s True Range (161.80 − 159.42). The close of 159.42 is below 159.55, so the direction flips to down. The line jumps up to the final upper band. Basic upper = 160.61 + 3 × 1.807 = 166.03, which is above the old upper band of 165.32, so it stays at 165.32.
  4. Bar 4. Basic upper = 159.87 + 3 × 1.717 = 165.02, below 165.32, so the line moves down to 165.02. The lower band resets to 154.72 because the previous close already broke the old lower band.

The highest close before this was 165.07, but the flip came at 159.42: 5.65 lower, about 3.1 times ATR. That is the built-in cost of a line 3 ATR from the mid price. Every flip arrives after price has already travelled some way against you.

Range: 4 flips 4 losses, −17.3 in total Close Supertrend up Supertrend down Flip Running profit when reversing at every flip 0 Bars 10 to 139
An illustrative simulated series, not a real market. Supertrend 10, 3 is computed from this series with the real formula. The lower panel is the running profit of holding the line's side and reversing at every flip, before spread: it rises in the trends and slides in the range.

Why it looks so accurate on screenshots

Look at the chart above the way most people do. The eye locks onto the long green line in the rally and the long red line in the fall, and concludes that following the line is enough. Three things make the picture lie:

  • The line is always on the side that just worked. Supertrend flips after price has moved. Looking back, it seems to know in advance every time, when it only followed.
  • Small losers, big winners. In the chart, the first trade made +46.8 points, while the range produced 4 losses in a row of 2.7 to 5.6 points each. Each one looks too small to notice. Together they come to 17.3 points, more than a third of the first trade’s gain, before any spread.
  • We pick the pretty pictures. The charts people share are usually from clear trends. Nobody screenshots months of chop.

This is the same hindsight bias described in Hindsight bias on charts. There is only one cure: count every trade with numbers, not with your eyes.

Testing it on simulated prices in 4 market conditions

We built simulated prices in node: 500 series per condition, 2,000 bars each. Every bar is made from 8 random steps so it has a realistic High and Low. We then computed Supertrend 10, 3 with the formula above. The rule: always hold the side of the line, reversing at the close of the bar that flips. Results are measured in ATR units so series can be compared. Cost is a spread of 0.1 ATR per trade.

  • Real trend: a small drift that changes direction every 150 to 400 bars
  • Random walk: no direction, no memory
  • Trend and range mixed: trending and ranging stretches alternate, 150 to 400 bars each
  • Mean-reverting: price is always pulled back toward a middle level, like a ranging market
MarketNo costs (ATR per 1,000 bars)After spreadTrades per 1,000 barsWinning trades (after spread)Series ending positive (after spread)
Real trend+17.13+13.4936.437.2%75.0%
Random walk−0.78−4.6438.636.0%39.2%
Trend and range mixed−1.98−5.8538.635.7%38.4%
Mean-reverting−20.23−24.3240.933.5%7.2%
No costs Spread of 0.1 ATR per trade Real trend +17.1 +13.5 Random walk −0.8 −4.6 Trend and range mixed −2.0 −5.8 Mean-reverting −20.2 −24.3 0 Loss Profit (ATR per 1,000 bars)
Averages over 500 simulated series per condition, 2,000 bars each, not real markets, reversing at every Supertrend 10, 3 flip. Light bars are before costs, dark bars after a spread of 0.1 ATR per trade.

What the table says:

  • On a random walk, it is about zero before costs (−0.02 ATR per trade). After spread it loses exactly trades × spread: 38.6 × 0.1 = 3.86, the gap between −0.78 and −4.64. Supertrend does not create an edge out of prices that have nothing to catch.
  • It only makes money when there is a real trend, and it makes it the trend-following way: winning only about 37% of trades. The best 10% of trades earned 3.4 times the total net profit, so the other 90% lost money together. Miss a few big trades and you are negative, which matches the picture in Trend following research.
  • Mean reversion hurts most. The line flips when price reaches the edge of the range, exactly where price tends to turn back, so it enters at the wrong moment by design.
  • Trending half the time still loses. The ranging stretches eat the trending profit. Half the trades lost 1.37 ATR or more (the median after spread).

Supertrend does not predict trends. It just holds the side price has just moved toward. If the market really trends, it gains. If not, it pays the spread every time it flips.

Limits: the simulated prices have no gaps, no news, and a fixed spread. Real markets add all of these, so real results usually look worse than the simulation.

Our own backtests on gold

In our backtests we did not test the standard Supertrend as an entry directly. We tested a close relative: a one-way ratcheting trend line built from a 21-bar Bollinger Band and a 5-bar ATR, which also flips when price closes through it (same idea, not the same formula). The test ran on gold M5 with a fixed 0.01 lot and the same exit engine for every version, a close target and Stop loss with a tight trail. We compared it with placing stop orders around the box of the last 5 bars, which does no analysis at all.

YearEnter when the line flips5-bar box, no analysis
2022−48 dollars (PF 0.93, 1,646 trades)+386 dollars (PF 1.40, 2,255 trades)
2023−292 dollars (PF 0.67)+272 dollars (PF 1.30)
2026−32 dollars (PF 0.96, 91.35% of 902 trades won)−392 dollars (PF 0.82)

PF (Profit factor) is total profit divided by total loss; below 1 is a loss. Only 2026 uses real tick data. 2022 to 2025, including the separate test below, use ticks generated from 1-minute bars, which tends to make tight trails look better than they are.

The lesson from this set: using the flip to choose direction turned the profitable years negative. The line flips so late that the leg left to ride is short. 2026 is also a neat example of winning 91% and still losing money. In a separate test, entering at every flip of the same line, with a swing Stop loss and a target of 2 times the risk, lost money in every one of the 5 years tested (2022 to 2026), at about 25 to 30 trades a day, which pays a lot of spread.

All of this is backtesting. Past results do not predict future results, and they are not returns you should expect.

3 better ways to use Supertrend

1. Use it as a trailing stop, not a reversal signal

What Supertrend does well is tell you that “price has come back further than normal volatility explains”, which is the definition of a good trailing stop. Choose your entry for other reasons, such as support and resistance, a range breakout or your own plan, then use the Supertrend line as a Stop loss that moves with the trade. When the line flips, exit. You don’t have to reverse into a new trade.

  • The initial Stop loss is about 3 ATR from the mid price, so always size the position from that distance. See Position size from Stop loss
  • Supertrend is very close to the Chandelier Exit. The difference is the anchor: the Chandelier measures from the highest high, Supertrend from the bar’s mid price. Compare trailing methods in 7 trailing stops compared

2. Add a market-condition filter

Supertrend hurts most in ranges, so a useful filter is one that tells you whether the market is going anywhere. We tried Kaufman’s Efficiency Ratio (ER): the distance price actually travelled divided by the total distance it moved back and forth over that window. 0 means going in circles, 1 means a straight line. The rule: follow the line only while ER is above a threshold, and stay out below it. Tested on 500 mixed trend-and-range series, with a 0.1 ATR spread. We tried 6 window and threshold combinations; the table shows 3 of them.

FilterATR per 1,000 barsTrades per 1,000 barsSeries ending positive
No filter−6.0839.136.8%
ER 50 bars > 0.1−7.1269.131.0%
ER 50 bars > 0.3−0.0214.544.2%
ER 100 bars > 0.2+1.3513.052.0%

A good filter moved the result from a loss to roughly break-even, mostly by trading less, not by picking trades much better. A filter set too loose (ER 50 bars > 0.1) did worse than no filter, because it switched in and out more often. And the threshold is one more number to choose, so it can be fitted to the past just as easily. Another popular filter is ADX: see ADX trend strength and Market regime change.

3. Check that your setting sits on a plateau

Before trusting one setting, try the settings around it and see whether the results stay similar. This table is the average of 300 trending series, after a 0.1 ATR spread, in ATR per 1,000 bars.

ATR (bars)Multiplier 2Multiplier 3Multiplier 4
7+7.5+13.1+17.1
10+7.5+13.3+17.3
14+7.4+13.2+17.3
20+7.1+13.6+16.9

The results are smooth across the grid. The ATR length barely matters; the multiplier matters more because it controls how often the line flips. That is what a plateau looks like. On random walks, the average of all 12 cells is negative (−4.1 to −7.1).

Look at one series at a time, though, and the picture changes. We took 300 random-walk series and picked the best of the 12 settings for each. 202 of them (67%) had at least one setting that looked profitable, with the best setting averaging +8.3 ATR per 1,000 bars, on prices with nothing to catch. The best setting on a single chart tells you very little. Read more in Peak or plateau and Multiple testing and data snooping.

Common mistakes

  • Judging from screenshots. A line that looks accurate in hindsight is a line that follows price. Count the losing trades in the ranges before you believe it
  • Reversing at every flip in every market. In ranges and mean-reverting markets, this is a steady way of paying the spread
  • Lowering the multiplier to exit sooner. The line flips more often and winners get smaller. On random walks, multiplier 2 lost more than multiplier 4 in every row
  • Acting before the bar closes. The line on an open bar can change, and a mid-bar signal can vanish at the close
  • Comparing platforms without checking the ATR formula. SMA and Wilder versions can flip on different bars
  • Forgetting to size from the line’s distance. The line sits about 3 ATR away. With the same lot every time, your risk per trade swings with volatility
Try it with your own numbers

Frequently asked questions

What is the best Supertrend setting?

There isn't one. TradingView's default is a 10-bar ATR with a multiplier of 3. A wider multiplier flips less often and pays less spread, but exits later. In our simulations the ATR length barely changed results while the multiplier changed them more. Choose a range where results stay similar, not the single best point.

Does Supertrend repaint?

Closed bars don't change. On the bar that is still open, the line can flip and flip back, because it uses a close that is still moving. Only count a signal once the bar has closed.

Can I use Supertrend on gold or crypto?

The same formula works on any market, and the problem is the same everywhere, namely ranges where the line flips back and forth. On small timeframes the spread is larger relative to ATR, so every flip costs more. Compare the spread with the ATR of your timeframe first.

This is general education, not investment advice. Trading is risky and you may lose all of your capital.

Tools Chat on LINE