Supertrend formula: how to calculate Supertrend (with Excel)
How the Supertrend line is worked out — ATR bands around each candle's midpoint and the rules that move the line from one band to the other. With a worked example (settings 10, 3), the Excel formulas, a free Excel sheet and a box to calculate Supertrend from your own prices.
Last updated:
Needs: high, low, close · Standard settings: ATR period 10 · Multiplier 3
The Supertrend formula
ATR = ATR (10), Wilder's smoothing
Basic upper = (High + Low) ÷ 2 + 3 × ATR
Basic lower = (High + Low) ÷ 2 − 3 × ATR
Final upper = Basic upper, if Basic upper < previous Final upper
or previous Close > previous Final upper
otherwise previous Final upper
Final lower = Basic lower, if Basic lower > previous Final lower
or previous Close < previous Final lower
otherwise previous Final lower
Supertrend: if yesterday it was on the upper band →
today = Final lower if Close > Final upper, else Final upper
if yesterday it was on the lower band →
today = Final upper if Close < Final lower, else Final lower10 is the ATR period and 3 the multiplier. On the very first candle there is no “yesterday”, so the line starts on the upper band. The ATR is worked out exactly as on the ATR formula page.
How to calculate Supertrend step by step
- Work out the true range and the 10-period ATR. The first ATR, on Day 10, is the average of the first 10 true ranges: 20.80.
- Build the basic bands around the candle's midpoint. Day 10: (1,046.15 + 1,028.50) ÷ 2 ± 3 × 20.80 gives a basic upper band of 1,099.73 and a basic lower band of 974.92. Day 10 is the first candle with an ATR, so its final bands equal its basic bands, and the Supertrend starts on the upper band: 1,099.73.
- Apply the final-band rule. Day 11's basic upper band (1,095.14) is lower than the previous final upper (1,099.73), so the final upper band moves down to 1,095.14. Its basic lower band (974.36) is not higher than the previous final lower (974.92) and the previous close didn't go below it, so the final lower band stays at 974.92.
- Check the close against the band the line is on. The line stays on the upper band until Day 43, when the close (919.00) goes above the final upper band (912.13). From then the Supertrend is the final lower band: 844.74, and the Trend column changes from “Down” to “Up”.
- Repeat for every candle. On Day 60 the example's Supertrend is 942.08, on the lower band.
Worked example — and calculate Supertrend from your own prices
The table works through 60 daily candles of an imaginary stock, column by column — the same columns as the Excel sheet. To calculate Supertrend for your own stock, clear the box and paste your high, low, close from Excel or your broker's download.
Latest values
| Day | High | Low | Close | True range | ATR (10) | Basic upper | Basic lower | Final upper | Final lower | Supertrend | Trend |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Day 1 | 1,010.00 | 990.60 | 1,001.15 | 19.40 | |||||||
| Day 2 | 1,004.60 | 987.75 | 987.95 | 16.85 | |||||||
| Day 3 | 1,011.50 | 986.00 | 1,009.15 | 25.50 | |||||||
| Day 4 | 1,015.00 | 1,001.85 | 1,012.60 | 13.15 | |||||||
| Day 5 | 1,012.00 | 990.80 | 993.25 | 21.80 | |||||||
| Day 6 | 1,012.60 | 990.90 | 1,008.60 | 21.70 | |||||||
| Day 7 | 1,018.95 | 1,003.80 | 1,013.60 | 15.15 | |||||||
| Day 8 | 1,012.95 | 994.75 | 1,001.55 | 18.85 | |||||||
| Day 9 | 1,033.25 | 995.30 | 1,031.55 | 37.95 | |||||||
| Day 10 | 1,046.15 | 1,028.50 | 1,040.05 | 17.65 | 20.8000 | 1,099.7250 | 974.9250 | 1,099.7250 | 974.9250 | 1,099.7250 | Down |
| Day 11 | 1,041.80 | 1,027.70 | 1,033.15 | 14.10 | 20.1300 | 1,095.1400 | 974.3600 | 1,095.1400 | 974.9250 | 1,095.1400 | Down |
| Day 12 | 1,065.80 | 1,031.15 | 1,064.80 | 34.65 | 21.5820 | 1,113.2210 | 983.7290 | 1,095.1400 | 983.7290 | 1,095.1400 | Down |
| Day 13 | 1,086.00 | 1,056.85 | 1,083.55 | 29.15 | 22.3388 | 1,138.4414 | 1,004.4086 | 1,095.1400 | 1,004.4086 | 1,095.1400 | Down |
| Day 14 | 1,090.25 | 1,067.25 | 1,067.95 | 23.00 | 22.4049 | 1,145.9648 | 1,011.5352 | 1,095.1400 | 1,011.5352 | 1,095.1400 | Down |
| Day 15 | 1,074.30 | 1,061.45 | 1,063.50 | 12.85 | 21.4494 | 1,132.2233 | 1,003.5267 | 1,095.1400 | 1,011.5352 | 1,095.1400 | Down |
| Day 16 | 1,067.35 | 1,025.90 | 1,030.20 | 41.45 | 23.4495 | 1,116.9735 | 976.2765 | 1,095.1400 | 1,011.5352 | 1,095.1400 | Down |
| Day 17 | 1,033.00 | 1,011.75 | 1,012.20 | 21.25 | 23.2295 | 1,092.0636 | 952.6864 | 1,092.0636 | 1,011.5352 | 1,092.0636 | Down |
| Day 18 | 1,019.90 | 979.85 | 981.60 | 40.05 | 24.9116 | 1,074.6097 | 925.1403 | 1,074.6097 | 1,011.5352 | 1,074.6097 | Down |
| Day 19 | 988.30 | 969.40 | 970.55 | 18.90 | 24.3104 | 1,051.7813 | 905.9187 | 1,051.7813 | 905.9187 | 1,051.7813 | Down |
| Day 20 | 973.10 | 959.05 | 960.90 | 14.05 | 23.2844 | 1,035.9281 | 896.2219 | 1,035.9281 | 905.9187 | 1,035.9281 | Down |
| Day 21 | 980.35 | 958.30 | 978.30 | 22.05 | 23.1609 | 1,038.8078 | 899.8422 | 1,035.9281 | 905.9187 | 1,035.9281 | Down |
| Day 22 | 981.50 | 957.00 | 958.85 | 24.50 | 23.2948 | 1,039.1345 | 899.3655 | 1,035.9281 | 905.9187 | 1,035.9281 | Down |
| Day 23 | 963.00 | 942.60 | 946.75 | 20.40 | 23.0054 | 1,021.8161 | 883.7839 | 1,021.8161 | 905.9187 | 1,021.8161 | Down |
| Day 24 | 957.70 | 931.65 | 937.95 | 26.05 | 23.3098 | 1,014.6045 | 874.7455 | 1,014.6045 | 905.9187 | 1,014.6045 | Down |
| Day 25 | 945.75 | 926.05 | 927.85 | 19.70 | 22.9488 | 1,004.7465 | 867.0535 | 1,004.7465 | 905.9187 | 1,004.7465 | Down |
| Day 26 | 924.60 | 910.25 | 911.20 | 17.60 | 22.4140 | 984.6669 | 850.1831 | 984.6669 | 905.9187 | 984.6669 | Down |
| Day 27 | 919.05 | 900.00 | 905.15 | 19.05 | 22.0776 | 975.7577 | 843.2923 | 975.7577 | 905.9187 | 975.7577 | Down |
| Day 28 | 904.50 | 884.70 | 885.95 | 20.45 | 21.9148 | 960.3444 | 828.8556 | 960.3444 | 828.8556 | 960.3444 | Down |
| Day 29 | 891.25 | 871.55 | 874.70 | 19.70 | 21.6933 | 946.4800 | 816.3200 | 946.4800 | 828.8556 | 946.4800 | Down |
| Day 30 | 880.70 | 849.70 | 855.80 | 31.00 | 22.6240 | 933.0720 | 797.3280 | 933.0720 | 828.8556 | 933.0720 | Down |
| Day 31 | 868.95 | 858.15 | 862.15 | 13.15 | 21.6766 | 928.5798 | 798.5202 | 928.5798 | 828.8556 | 928.5798 | Down |
| Day 32 | 875.05 | 859.50 | 866.45 | 15.55 | 21.0639 | 930.4668 | 804.0832 | 928.5798 | 828.8556 | 928.5798 | Down |
| Day 33 | 870.55 | 843.00 | 845.10 | 27.55 | 21.7125 | 921.9126 | 791.6374 | 921.9126 | 828.8556 | 921.9126 | Down |
| Day 34 | 854.70 | 846.55 | 851.55 | 9.60 | 20.5013 | 912.1289 | 789.1211 | 912.1289 | 828.8556 | 912.1289 | Down |
| Day 35 | 863.70 | 847.85 | 860.20 | 15.85 | 20.0362 | 915.8835 | 795.6665 | 912.1289 | 828.8556 | 912.1289 | Down |
| Day 36 | 862.95 | 845.40 | 854.80 | 17.55 | 19.7875 | 913.5376 | 794.8124 | 912.1289 | 828.8556 | 912.1289 | Down |
| Day 37 | 882.25 | 858.05 | 877.20 | 27.45 | 20.5538 | 931.8114 | 808.4886 | 912.1289 | 828.8556 | 912.1289 | Down |
| Day 38 | 893.65 | 868.85 | 888.45 | 24.80 | 20.9784 | 944.1852 | 818.3148 | 912.1289 | 828.8556 | 912.1289 | Down |
| Day 39 | 908.35 | 889.60 | 905.40 | 19.90 | 20.8706 | 961.5867 | 836.3633 | 912.1289 | 836.3633 | 912.1289 | Down |
| Day 40 | 913.10 | 895.65 | 896.80 | 17.45 | 20.5285 | 965.9605 | 842.7895 | 912.1289 | 842.7895 | 912.1289 | Down |
| Day 41 | 894.65 | 887.85 | 889.60 | 8.95 | 19.3707 | 949.3620 | 833.1380 | 912.1289 | 842.7895 | 912.1289 | Down |
| Day 42 | 898.55 | 884.80 | 895.30 | 13.75 | 18.8086 | 948.1008 | 835.2492 | 912.1289 | 842.7895 | 912.1289 | Down |
| Day 43 | 920.60 | 889.25 | 919.00 | 31.35 | 20.0627 | 965.1132 | 844.7368 | 912.1289 | 844.7368 | 844.7368 | Up |
| Day 44 | 920.60 | 916.30 | 918.35 | 4.30 | 18.4865 | 973.9094 | 862.9906 | 973.9094 | 862.9906 | 862.9906 | Up |
| Day 45 | 919.30 | 903.80 | 906.25 | 15.50 | 18.1878 | 966.1134 | 856.9866 | 966.1134 | 862.9906 | 862.9906 | Up |
| Day 46 | 937.35 | 900.30 | 932.10 | 37.05 | 20.0740 | 979.0471 | 858.6029 | 966.1134 | 862.9906 | 862.9906 | Up |
| Day 47 | 947.15 | 930.20 | 944.35 | 16.95 | 19.7616 | 997.9599 | 879.3901 | 966.1134 | 879.3901 | 879.3901 | Up |
| Day 48 | 949.20 | 937.25 | 948.70 | 11.95 | 18.9805 | 1,000.1664 | 886.2836 | 966.1134 | 886.2836 | 886.2836 | Up |
| Day 49 | 971.15 | 949.05 | 966.35 | 22.45 | 19.3274 | 1,018.0823 | 902.1177 | 966.1134 | 902.1177 | 902.1177 | Up |
| Day 50 | 965.90 | 954.75 | 955.60 | 11.60 | 18.5547 | 1,015.9890 | 904.6610 | 1,015.9890 | 904.6610 | 904.6610 | Up |
| Day 51 | 971.35 | 954.15 | 969.10 | 17.20 | 18.4192 | 1,018.0076 | 907.4924 | 1,015.9890 | 907.4924 | 907.4924 | Up |
| Day 52 | 997.00 | 966.55 | 984.35 | 30.45 | 19.6223 | 1,040.6419 | 922.9081 | 1,015.9890 | 922.9081 | 922.9081 | Up |
| Day 53 | 992.30 | 980.25 | 980.90 | 12.05 | 18.8651 | 1,042.8702 | 929.6798 | 1,015.9890 | 929.6798 | 929.6798 | Up |
| Day 54 | 984.70 | 961.40 | 962.50 | 23.30 | 19.3086 | 1,030.9757 | 915.1243 | 1,015.9890 | 929.6798 | 929.6798 | Up |
| Day 55 | 964.60 | 953.00 | 960.20 | 11.60 | 18.5377 | 1,014.4131 | 903.1869 | 1,014.4131 | 929.6798 | 929.6798 | Up |
| Day 56 | 969.05 | 954.50 | 967.35 | 14.55 | 18.1389 | 1,016.1918 | 907.3582 | 1,014.4131 | 929.6798 | 929.6798 | Up |
| Day 57 | 982.20 | 960.60 | 971.00 | 21.60 | 18.4850 | 1,026.8551 | 915.9449 | 1,014.4131 | 929.6798 | 929.6798 | Up |
| Day 58 | 987.10 | 967.55 | 981.75 | 19.55 | 18.5915 | 1,033.0996 | 921.5504 | 1,014.4131 | 929.6798 | 929.6798 | Up |
| Day 59 | 999.95 | 979.00 | 994.85 | 20.95 | 18.8274 | 1,045.9571 | 932.9929 | 1,014.4131 | 932.9929 | 932.9929 | Up |
| Day 60 | 1,015.15 | 987.35 | 1,012.35 | 27.80 | 19.7246 | 1,060.4239 | 942.0761 | 1,014.4131 | 942.0761 | 942.0761 | Up |
The example prices are made up for this page — they are not real market data. Supertrend is a calculation from past prices, not a forecast, a signal or advice to buy or sell. MyAlgoMate provides trading technology, not investment advice.
How to calculate Supertrend in Excel
Put the headings in row 1 and the first candle in row 2, oldest at the top. Then type these formulas — each column uses the ones to its left:
- A
Day
A2 downwards: your dates, oldest at the top.
- B
High
B2 downwards: the high prices, oldest at the top.
- C
Low
C2 downwards: the low prices, oldest at the top.
- D
Close
D2 downwards: the closing prices, oldest at the top.
- E
True range
E2
=B2-C2— this cell only (the starting value).E3
=MAX(B3-C3,ABS(B3-D2),ABS(C3-D2))— then copy it down to the last row. - F
ATR (10)
F11
=AVERAGE(E2:E11)— this cell only (the starting value).F12
=(F11*9+E12)/10— then copy it down to the last row. - G
Basic upper
G11
=(B11+C11)/2+3*F11— then copy it down to the last row. - H
Basic lower
H11
=(B11+C11)/2-3*F11— then copy it down to the last row. - I
Final upper
I11
=G11— this cell only (the starting value).I12
=IF(OR(G12<I11,D11>I11),G12,I11)— then copy it down to the last row. - J
Final lower
J11
=H11— this cell only (the starting value).J12
=IF(OR(H12>J11,D11<J11),H12,J11)— then copy it down to the last row. - K
Supertrend
K11
=I11— this cell only (the starting value).K12
=IF(K11=I11,IF(D12>I12,J12,I12),IF(D12<J12,I12,J12))— then copy it down to the last row. - L
Trend
L11
=IF(K11=J11,"Up","Down")— then copy it down to the last row.
In the sheet, “Up” means the line is on the final lower band (below the candles) and “Down” that it is on the final upper band (above them). The labels only describe which band is in use.
Prefer not to type them? The free sheet has every formula filled in for the example prices — replace the prices with yours and extend the rows. It opens in Microsoft Excel (we checked every value against the table above), and you can import it into Google Sheets or LibreOffice.
Download the free Supertrend Excel sheet (.xlsx)What is the Supertrend indicator?
Supertrend is a line drawn on a price chart. It is built from the Average True Range (ATR), a measure of how far price usually moves in one candle. The line sits on one side of the candles and switches to the other side when a candle closes through it. It was developed by Olivier Seban in the early 2000s, and its common defaults are an ATR period of 10 and a multiplier of 3 (see the cTrader help page). It is a calculation from past prices. It does not forecast anything.
What the two settings change
| Setting | What it changes |
|---|---|
| ATR period (default 10) | How many candles are used to measure the usual range. A smaller number reacts to new candles faster. |
| Multiplier (default 3) | How many ATRs the bands sit from the midpoint. A bigger number puts the line further from price. |
| Maths check: midpoint 100, ATR 4 | Multiplier 2 gives bands 108 / 92. Multiplier 3 gives bands 112 / 88. |
The same candles with different settings give a different line.
How often the line switched in the example
In the 60 example candles (settings 10, 3) the line changed bands 1 time: Day 43 (to the lower band). Counted straight from the Trend column of the example table above.
Where Supertrend has limits
Like any line built from past prices, it lags. When price moves sideways, the line can switch sides several times, because each switch needs only one close through the band. This is a property of the maths, not a comment on any result.
Supertrend and other lines
| Line | How it is built |
|---|---|
| Moving average | The average of closing prices. No ATR. |
| Supertrend | The high-low midpoint plus or minus a multiple of the ATR, with one band shown at a time. |
| Parabolic SAR | A different formula that also trails price. |
What the Supertrend line shows
The line follows one band at a time: the upper band above the candles or the lower band below them. It changes sides only when a candle closes beyond the band it is on. That is all the formula does — it is a calculation from past prices, not a forecast and not advice, and how you use it is your own decision.
Why your Supertrend may not match your chart
- The ATR method. Wilder's smoothing (this page and most charts) vs a simple average of the true range.
- The starting point. The bands carry forward from the first candle, so start from plenty of history — the difference fades.
- Settings and prices. ATR period, multiplier, spot vs futures, timeframe.
Supertrend calculation — questions, answered.
Work out the ATR (10). Basic upper band = (High + Low) ÷ 2 + 3 × ATR; basic lower band = (High + Low) ÷ 2 − 3 × ATR. The final upper band may only move down and the final lower band may only move up, unless the previous close crossed them. The Supertrend line sits on the final upper band until a close goes above it, then on the final lower band until a close goes below it.
Put high, low and close in columns B, C and D. Add true range and a 10-period ATR (Wilder's smoothing), then the basic bands, then the final bands with IF and OR, and finally the Supertrend column, which checks which band yesterday's value was on. The column-by-column formulas are on this page, and the free sheet has all of them filled in.
The first number is the ATR period and the second is the multiplier. 10, 3 means a 10-period ATR with the bands 3 ATRs from the candle's midpoint; 7, 3 uses a 7-period ATR with the same multiplier. A bigger multiplier puts the bands further away. You can enter any settings in the calculator above.
Because of the final-band rule. The upper band is only allowed to come down (and the lower band only to go up) while price stays on the same side, so when the new basic band would move the other way, the final band simply repeats yesterday's value.
Both. The bands are built around the midpoint of each candle's high and low, while the switch from one band to the other is decided by the close.
Check the ATR: most charts use Wilder's smoothing, but some versions use a simple average of the true range. The starting point matters too — Supertrend carries its bands forward from the first candle, so use plenty of history. Spot vs futures prices and the timeframe also change it.
The formula uses only the high, low and close of each candle. On a finished candle the value does not change. On a candle that is still forming, the close is not final yet, so the value can change until that candle closes.
Any. The formula works on whatever candles you give it, and the ATR is measured in those candles. A different timeframe means different candles, so the values are different too.
A moving average averages closing prices. Supertrend uses the midpoint of each candle's high and low plus or minus a multiple of the ATR, and it shows one band at a time.
More indicator formulas, with Excel sheets
Turn your own rules into automated orders.
Already use Supertrend in your own rules? MyAlgoMate's algo trading software places the orders your rules call for at 150+ Indian brokers — and TradeBridge turns your own TradingView or Chartink alerts into live orders. You decide the rules; we provide the technology.