Ready to go further
Next: test a rule honestly
The backtesting guide covers the steps and the traps that catch most indicator rules.
What is included
- What it is, in plain words
- The formula or mechanism, with exact arithmetic
- How it hits grid, martingale and DCA bots
- A check you can run before you switch a bot on
Who it is for
- People who run or plan to run a trading bot
- Anyone reading a backtest or a bot sales page
- Readers who want the numbers, not the pitch
- Not advice, and not a signal service
Key facts
- Supertrend is a trailing line built from the average true range (ATR). In an up trend it sits below the price and only moves up. In a down trend it sits above the price and only moves down.
- When the close crosses the line the trend flips and the line jumps to the other side. In the made-up path below it flips 5 times in 81 bars (calculated by us on 28 Oct 2026, exact).
- The usual settings are an ATR period of 10 and a multiplier of 3. They are conventions, and each change is another setting that can be overfitted.
- A bigger multiplier keeps the line further away, so it flips less often and gives back more of a move before it does.
- A bot that buys on a flip up and sells on a flip down is a trend follower. It tends to do well in a long trend and badly in a range.
The formula
Start with the true range of each bar: the largest of the bar's high minus low, the high minus the previous close, and the previous close minus the low. The ATR is the average of the last 10 true ranges. It measures how far the price usually moves in a bar, gaps included. Then build two bands around the middle of each bar, which is its high plus low divided by two.
ATR = average of the last 10 true ranges
Upper band = (high + low) / 2 + 3 x ATR
Lower band = (high + low) / 2 - 3 x ATR
The final bands only tighten. The final lower band is not allowed to fall while the price stays above it, and the final upper band is not allowed to rise while the price stays below it. That is what makes the line trail. In an up trend the Supertrend is the final lower band. If the close falls below it, the trend turns down and the Supertrend becomes the final upper band, and the reverse for a down trend.
A worked example
The made-up path has 90 bars: a rise of 0.08 a bar with a wave of plus and minus 8 on top, and each bar's high and low are 1.5 above and below its close. At bar 17, the first flip, the close is 99.32 and the line is at 108.32 on the upper side, after the ATR of 3.00 set the width of the bands. By bar 89 the close is 100.18, the line is 107.91, and the indicator reads a down trend.
Across the 81 bars the indicator was in an up trend for 41 and in a down trend for 40. The wave is steady, so the line flips on a regular beat: a rule that traded each flip would trade 5 times and pay costs 5 times.
What it does well and badly
- It gives a stop for free. The line is a trailing stop level that rises with the price in an up trend. See the stop loss calculator for the cost of a stop.
- It follows, it does not predict. A flip happens only after the close has crossed the line, so part of the move has gone.
- It flips in a range. When the price swings sideways inside its ATR bands, the line flips again and again, and each flip pays the spread.
- Gaps and news. A gap through the line fills at the next price, not at the line, so the loss can be larger than the distance to the line suggested. See slippage.
How a bot misuses it
The common mistake is to tune the period and the multiplier until the past looks best. With two settings and a long history, some pair will look good by chance, which is overfitting. Another is to read the line before the bar has closed, so the signal flickers and the test uses information the bot would not have had, which is look-ahead bias. A third is to size by the distance to the line without a cap, so a wide band means a big loss when it flips.
How to check a rule that uses it
Write the rule with both settings, use closed bars only, test it in a trend and in a range and count the trades. Use full costs and keep data back for one final test, as in backtesting. Look at the max drawdown and the number of trades, not only the total.
What this page does not tell you
It does not say Supertrend works. It shows the arithmetic and the delay built into it. The prices are made up and this is education, not a signal.
Keep Going
Related Tools and Guides
Keep exploring
FAQ
Frequently Asked Questions
What is the Supertrend indicator?
A trailing line built from the average true range. It sits below the price in an up trend and above it in a down trend, and flips side when the close crosses it.
How is Supertrend calculated?
Take the middle of each bar and add or subtract the multiplier times the ATR to get two bands. The final bands only tighten, and the line is the lower band in an up trend and the upper band in a down trend.
What are the usual Supertrend settings?
An ATR period of 10 and a multiplier of 3 are common. They are conventions, and a different pair is another setting that can be overfitted.
Does Supertrend predict the price?
No. It follows the price and flips only after the close has crossed the line, so it lags by design.
Can a bot trade Supertrend?
It can, and a trend follower may do well in a long trend. It flips often in a range, so test it with full costs in several kinds of market.
Are the numbers on this page real?
Example numbers are made up to show how the maths works, and the page says so. A figure only counts as exact when the page says it was calculated on a stated date. Nothing you enter in a calculator leaves your browser.
Can I use this to decide whether to run a bot?
It can show whether a bot's numbers hold together and how much an account can lose. It cannot say what the market will do, and it is not advice. Use it to ask better questions, then read the terms of your own broker or exchange.
Is this financial advice?
No. It is general education about a calculation. The prices are made up and it is not a signal.
Know the Risk Before You Run It
Free calculators and guides, added every week. Leave your details and we will email you when new ones go up.
Trading carries a risk of loss