reference · Technical analysis
Supertrend: ATR Bands and State Changes
Supertrend combines an ATR-based envelope with a state rule that selects which band to display. A separate close-based trailing-stop worksheet makes the ratchet and gap-execution boundary explicit.

Calculate the raw bands first
A common construction starts from the midpoint of the bar, (high + low) / 2. It adds and subtracts a multiplier of ATR to form basic upper and lower bands. The final bands can retain earlier values according to conditional rules, and a close crossing the relevant retained band can switch the direction state. TradingView publishes its Supertrend formulas and state conditions.
This distinction matters when recreating an indicator. Plotting midpoint plus or minus ATR creates an envelope, but does not reproduce the carried-band logic. The ATR period, smoothing, multiplier, initialization and equality comparisons all affect the resulting sequence.
A hypothetical state transition
Assume high is 104, low is 100, ATR is 2 and multiplier is 3. Midpoint is 102, so the basic upper band is 108 and basic lower band is 96. Suppose the preceding final upper band was 107 and preceding close was 103. Under the documented upper-band rule, the 108 candidate can be rejected in favor of retaining 107.
If the prior state was downward, price is tested against that retained upper boundary. A completed close of 106 does not cross above 107, so the state remains downward. A later completed close of 108 can flip the state upward, after the band values for that observation have been calculated. The displayed line then follows the applicable lower band rather than remaining at the upper boundary.
This example isolates the state decision; it is not a complete multi-bar backtest. To reproduce every output, a worksheet needs each bar's high, low, close, ATR, basic bands, final bands and previous state. Retaining only the last plotted line loses information necessary to explain the next update.
Understand the signal timestamp
A current bar can cross a boundary and then close back on the other side. A strategy using intrabar observations can therefore act differently from one using confirmed closes. A historical chart generally shows the completed state, so its apparent sequence may not represent every event that was visible in real time.
Price gaps also separate an indicator's threshold from an executable order price. If a line is at 107 but the first available market quote is 110, the chart does not create liquidity at 107. A Supertrend value used as a stop reference remains subject to order type, tick grid and actual execution.
Work through a separate ATR trailing-stop rule
The worksheet below is a declared educational convention, not TradingView's Supertrend formula and not an order sent by TradeCopier. Supertrend calculates midpoint-based upper and lower bands and selects one according to its retained-band state. This second example instead trails a completed close by twice a two-bar ATR. Both use ATR, but their lines and direction changes need not match. TradingView defines true range from the current high and low plus the previous close and describes its ATR smoothing convention; the short length here is chosen only so every number can be audited.
For each bar, true range is the greatest of high minus low, the absolute difference between high and the previous close, and the absolute difference between low and the previous close. Seed ATR at bar 0 with the mean of the warm-up bar W and bar 0 true ranges. Thereafter ATR = (previous ATR + current true range) / 2. Use multiplier 2, exact decimal values and a fictional price increment of 0.25. The first long state is explicitly initialized after bar 0 closes; it is not a historical trade or a discovered optimum.
At each later confirmed close, compare that close with the prior active marker. A long state flips to short only when the close is strictly below its prior marker; a short state flips to long only when the close is strictly above its prior marker. Equality retains the state. When a side continues, its long marker becomes max(prior marker, close − 2 × ATR) and its short marker becomes min(prior marker, close + 2 × ATR). A flip initializes the new side from that bar's close and ATR; it does not carry the other side's marker across. The newly calculated marker is available only after that close. This is a close-only chart state machine; a live stop order has different acceptance and trigger rules.
| Bar | Close | True range / ATR | Before: side / marker | Candidate | After: side / marker |
|---|---|---|---|---|---|
| W | 100 | 2 / unavailable | none | — | none |
| 0 | 100 | 2 / 2 | none | 100 − 4 = 96 | long / 96 |
| 1 | 101 | 2 / 2 | long / 96 | 101 − 4 = 97 | long / 97 |
| 2 | 103 | 4 / 3 | long / 97 | 103 − 6 = 97 | long / 97 |
| 3 | 101 | 3 / 3 | long / 97 | 101 − 6 = 95 | long / 97 |
| 4 | 96 | 5 / 4 | long / 97 | 96 + 8 = 104 | short / 104 |
| 5 | 95 | 2 / 3 | short / 104 | 95 + 6 = 101 | short / 101 |
| 6 | 98 | 3 / 3 | short / 101 | 98 + 6 = 104 | short / 101 |
| 7 | 102 | 4 / 3.5 | short / 101 | 102 − 7 = 95 | long / 95 |
The long marker rises from 96 to 97, then stays at 97 even when the bar-3 candidate falls to 95. Bar 4 closes at 96, strictly below the prior 97, so the model switches to a new short marker of 104. The short marker then falls to 101 and stays there when its candidate rises to 104. Bar 7 closes at 102, strictly above the prior 101, so a new long marker starts at 95. These are model states; none of the rows records a real entry, stop amendment or fill.
Download the nine-row state ledger. It includes previous close, high, low, close, true range, ATR seed and recurrence, prior state and marker, candidate, new state and marker. Recompute it from the price columns before using the result. Missing or non-finite prices, an unavailable previous close, incomplete warm-up, a different ATR smoothing rule or an invalid tick increment make this exact comparison unavailable rather than zero.
A stop trigger is not the chart line or the fill
Branch separately after ledger bar 3, whose close is 101 and whose chart reference is 97. Suppose a trader separately submits a sell stop-market order at 97 in a fictional stock, and the broker confirms acceptance. The next session's first eligible last-sale print is 94.50 under an explicitly assumed last-sale trigger policy, so the stop becomes a market order. An illustrative fill at 94.25 is 2.75 below the 97 trigger. It is not a guaranteed fill, a TradeCopier result or another ledger bar. Investor.gov distinguishes a stop trigger from its execution price and notes that brokers can use different trigger standards.
A stop-limit order would add a price boundary but could remain unfilled after this gap. Before interpreting any real copied-account result, establish whether an order was submitted and accepted, the broker's trigger reference and session rules, the actual deals, and each account's final position. A chart update cannot prove the broker modified a stop; a threshold crossing cannot prove every follower received the same execution.
Inspect Supertrend behavior before choosing parameters
In Supertrend, a smaller multiplier can switch the displayed state more often; a larger one can delay recognition of a reversal. Neither change proves that overall results improve. Range-bound data may produce repeated state changes, while a long trend can make a heavily delayed setting look appealing in retrospect. The separate close-only worksheet above has its own declared rules and should be evaluated independently.
Check ATR construction and valid order increments. Use a documented backtest to record the exact implementation, decision time and costs. The useful output is an auditable state sequence, not a promise that each color change identifies a profitable trade.
Questions and answers
Is Supertrend just an ATR channel?
No. Its retained-band and direction-state rules are additional components. Reproducing only the raw envelope does not reproduce the indicator.
Can the current Supertrend signal disappear?
A signal based on an unfinished bar can change before close. Specify confirmed-bar or intrabar behavior and test that same convention.
Is the worked ATR trailing-stop rule the same as TradingView Supertrend?
No. The synthetic worksheet trails a confirmed close by twice a two-bar ATR and applies its own long and short ratchet rules. TradingView Supertrend uses midpoint-based upper and lower bands with different retained-band state logic.
Can a rising ATR loosen the worked trailing marker?
Within an unchanged long state, max(prior marker, new candidate) prevents the marker from falling. Within an unchanged short state, min(prior marker, new candidate) prevents it from rising. A state flip initializes a new marker on the opposite side.
Will a sell stop at 97 necessarily fill at 97 after a gap?
No. The stop price is a trigger, not a guaranteed execution price. In the separate fictional stock scenario, a 94.50 opening print under the stated broker trigger rule activates an accepted sell stop-market order and an illustrative fill at 94.25 is 2.75 below the stop.
Does a Supertrend line update mean my broker stop changed?
No. Chart calculation, order submission, broker acceptance, triggering and actual deals are separate events. Inspect each account order and fill record before assuming a live or copied stop was changed.
Sources and further checks
Use the current source for your exact instrument, account and platform. Referencing a general specification does not establish support for every TradeCopier workflow.
- TradingView: Supertrend · Checked September 24, 2026
- TradingView: Average True Range · Checked September 24, 2026
- Investor.gov: Stop, Stop-Limit, and Trailing Stop Orders · Checked September 24, 2026
Found an error? Send a correction with this page's address and a primary source. See our editorial standards for how we handle examples, claims and revisions.






