ATR Trailing Stop
The ATR Trailing Stop follows the close itself at a multiple of the Average True Range. It goes back to the Volatility System of J. Welles Wilder, who placed his stop a multiple of the Average True Range away from the extreme close of the trend, and Sylvain Vervoort formulated it as a trailing stop: it only rises while the close stays above it, only falls while the close stays below it, and jumps to the other side of the close when the close crosses it.
The formula for the ATR Trailing Stop starts from the loss, the distance of the stop from the close: k Average True Ranges over the last n periods, the Average True Range being Wilder’s moving average of the True Range, the largest of the period’s range and the distances of its high and low from the previous close:
\[\text{Loss} = k \cdot \text{ATR}(n)\]While the close and the close before are both above the previous stop, the stop rises with the close and never falls; while both are below, it falls with the close and never rises:
\[\text{Stop} = \max\left(\text{Stop}_{t-1}, \text{Close} - \text{Loss}\right) \quad \text{if } \min\left(\text{Close}, \text{Close}_{t-1}\right) > \text{Stop}_{t-1}\] \[\text{Stop} = \min\left(\text{Stop}_{t-1}, \text{Close} + \text{Loss}\right) \quad \text{if } \max\left(\text{Close}, \text{Close}_{t-1}\right) < \text{Stop}_{t-1}\]When the close crosses the previous stop, the stop restarts on the other side of the close:
\[\text{Stop} = \text{Close} - \text{Loss} \quad \text{if } \text{Close} > \text{Stop}_{t-1}\] \[\text{Stop} = \text{Close} + \text{Loss} \quad \text{if } \text{Close} \leq \text{Stop}_{t-1}\]Vervoort uses a 5-period Average True Range and a multiple of 3.5. A stop below the close marks an uptrend and protects a long position, a stop above it a downtrend and a short position, and a close through the stop ends the position. Because it follows the close rather than the median price or an average, it reacts faster than the Supertrend and the Profit Maximizer and flips more often.
The stop is a multiple of the Average True Range away from the price (the median price for the Supertrend, the close for the ATR Trailing Stop), or for the Profit Maximizer from its moving average.
Also known as: ATRTS, volatility stop, ATR stop.
In the Finance Toolkit this is get_supertrend with method="atr_trailing_stop", the same function as Supertrend.
Example · SHOP · 2025
Install the Finance Toolkit with pip install financetoolkit -U, then call get_supertrend:
from financetoolkit import Toolkit
toolkit = Toolkit(
tickers=["SHOP"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2025-01-01",
end_date="2025-12-31",
)
toolkit.technicals.get_supertrend(method="atr_trailing_stop").xs("SHOP", level=1, axis="columns")
| Parameter | Type | Description | Example |
|---|---|---|---|
period | str | The time period to consider for historical data. Options are: “intraday” (intraday prices), “daily” (daily prices), “weekly” (weekly prices), “monthly” (monthly prices), “quarterly” (quarterly prices), “yearly” (yearly prices). Defaults to “daily”. | "weekly" |
close_column | str | The column name for closing prices in the historical data. Defaults to “Adj Close”, in which case the open, high and low prices are adjusted for dividends in the same way. | "Close" |
window | int | Number of periods for the underlying Average True Range calculation, and with method=”profit_maximizer” of the EMA of the median price. Defaults to 10, as defined by Ozbilgic for the Profit Maximizer. | 20 |
multiplier | float | Multiplier applied to the Average True Range to determine how far the bands (or the stops of the Profit Maximizer) sit from the median price (or its average). Defaults to 3.0. | 2.0 |
rounding | int | None | The number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise). | 2 |
growth | bool | Whether to calculate the growth of the Supertrend and Trend Direction values. Defaults to False. | True |
lag | int | list[int] | The lag to use for the growth calculation. Defaults to 1. | 4 |
standardize | bool | Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False. | True |
method | str | Options are: “standard” (Supertrend), “profit_maximizer” (Profit Maximizer, PMax), “atr_trailing_stop” (ATR Trailing Stop). Defaults to “standard”. | "standard" |
atr_window | int | The number of periods of the Average True Range of the Profit Maximizer. Only used when method=”profit_maximizer”. Defaults to 10, as defined by Ozbilgic. | 10 |
transform | str | list[str] | None | Time series steps applied in order, such as “sma:12” (moving average), “ema:12”, “std:12”, “zscore:60”, “percentile:120”, “yoy”, “pct_change:3,annualize:3”, “log”, “diff”, “cumsum” or “hp_trend” and “hp_cycle” (Hodrick-Prescott), before growth. A window needs that many periods of history, so the first periods can be empty. Defaults to None. | None |
show_columns | str | list[str] | None | The columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column. | None, which keeps every column |
Which returns:
| Date | ATR Trailing Stop | Trend Direction |
|---|---|---|
| 2025-01-02 | 117.5700 | -1 |
| 2025-01-03 | 117.5700 | -1 |
| 2025-01-06 | 117.5700 | -1 |
| 2025-01-07 | 117.5700 | -1 |
| 2025-01-08 | 117.5700 | -1 |
| 2025-01-10 | 117.2400 | -1 |
| 2025-01-13 | 115.3350 | -1 |
| 2025-01-14 | 114.6110 | -1 |
| 2025-01-15 | 114.6110 | -1 |
| 2025-01-16 | 114.6110 | -1 |
| 2025-01-17 | 114.6110 | -1 |
| 2025-01-21 | 114.6110 | -1 |
| 2025-01-22 | 114.6110 | -1 |
| 2025-01-23 | 114.6110 | -1 |
| 2025-01-24 | 114.6110 | -1 |
| 2025-01-27 | 114.6110 | -1 |
| 2025-01-28 | 104.3160 | 1 |
| 2025-01-29 | 104.3160 | 1 |
| 2025-01-30 | 106.3530 | 1 |
| 2025-01-31 | 106.3530 | 1 |
| 2025-02-03 | 106.3530 | 1 |
| 2025-02-04 | 106.3530 | 1 |
| 2025-02-05 | 107.9490 | 1 |
| 2025-02-06 | 107.9490 | 1 |
| 2025-02-07 | 107.9490 | 1 |
| 2025-02-10 | 107.9490 | 1 |
| 2025-02-11 | 107.9490 | 1 |
| 2025-02-12 | 107.9490 | 1 |
| 2025-02-13 | 110.3790 | 1 |
| 2025-02-14 | 111.4000 | 1 |
| 2025-02-18 | 112.4980 | 1 |
| 2025-02-19 | 112.4980 | 1 |
| 2025-02-20 | 112.4980 | 1 |
| 2025-02-21 | 112.4980 | 1 |
| 2025-02-24 | 112.4980 | 1 |
| 2025-02-25 | 130.3160 | -1 |
| 2025-02-26 | 130.3160 | -1 |
| 2025-02-27 | 129.2180 | -1 |
| 2025-02-28 | 129.2180 | -1 |
| 2025-03-03 | 125.8120 | -1 |
| 2025-03-04 | 121.6580 | -1 |
| 2025-03-05 | 121.6580 | -1 |
| 2025-03-06 | 121.6580 | -1 |
| 2025-03-07 | 120.5130 | -1 |
| 2025-03-10 | 113.6270 | -1 |
| 2025-03-11 | 112.9270 | -1 |
| 2025-03-12 | 112.9270 | -1 |
| 2025-03-13 | 110.6690 | -1 |
| 2025-03-14 | 110.6690 | -1 |
| 2025-03-17 | 110.6690 | -1 |
| 2025-03-18 | 110.6690 | -1 |
| 2025-03-19 | 110.6690 | -1 |
| 2025-03-20 | 110.6690 | -1 |
| 2025-03-21 | 110.6690 | -1 |
| 2025-03-24 | 110.6690 | -1 |
| 2025-03-25 | 110.6690 | -1 |
| 2025-03-26 | 110.6690 | -1 |
| 2025-03-27 | 110.6690 | -1 |
| 2025-03-28 | 110.6690 | -1 |
| 2025-03-31 | 110.6690 | -1 |
| 2025-04-01 | 110.6690 | -1 |
| 2025-04-02 | 110.6690 | -1 |
| 2025-04-03 | 104.4520 | -1 |
| 2025-04-04 | 100.5710 | -1 |
| 2025-04-07 | 100.5710 | -1 |
| 2025-04-08 | 100.5710 | -1 |
| 2025-04-09 | 100.5710 | -1 |
| 2025-04-10 | 100.5710 | -1 |
| 2025-04-11 | 100.5710 | -1 |
| 2025-04-14 | 100.5710 | -1 |
| 2025-04-15 | 100.5710 | -1 |
| 2025-04-16 | 100.5710 | -1 |
| 2025-04-17 | 100.5710 | -1 |
| 2025-04-21 | 100.5710 | -1 |
| 2025-04-22 | 100.5710 | -1 |
| 2025-04-23 | 100.5710 | -1 |
| 2025-04-24 | 100.5710 | -1 |
| 2025-04-25 | 100.5710 | -1 |
| 2025-04-28 | 100.5710 | -1 |
| 2025-04-29 | 100.5710 | -1 |
| 2025-04-30 | 100.5710 | -1 |
| 2025-05-01 | 100.5710 | -1 |
| 2025-05-02 | 100.5710 | -1 |
| 2025-05-05 | 100.5710 | -1 |
| 2025-05-06 | 100.5710 | -1 |
| 2025-05-07 | 100.5710 | -1 |
| 2025-05-08 | 100.5710 | -1 |
| 2025-05-09 | 100.5710 | -1 |
| 2025-05-12 | 85.3620 | 1 |
| 2025-05-13 | 89.2018 | 1 |
| 2025-05-14 | 93.5596 | 1 |
| 2025-05-15 | 93.5596 | 1 |
| 2025-05-16 | 94.5830 | 1 |
| 2025-05-19 | 94.5830 | 1 |
| 2025-05-20 | 94.5830 | 1 |
| 2025-05-21 | 94.5830 | 1 |
| 2025-05-22 | 94.5830 | 1 |
| 2025-05-23 | 94.5830 | 1 |
| 2025-05-27 | 94.5830 | 1 |
| 2025-05-28 | 94.5830 | 1 |
| 2025-05-29 | 94.5830 | 1 |
| 2025-05-30 | 94.5830 | 1 |
| 2025-06-02 | 94.5830 | 1 |
| 2025-06-03 | 94.5830 | 1 |
| 2025-06-04 | 94.5830 | 1 |
| 2025-06-05 | 94.5830 | 1 |
| 2025-06-06 | 98.5610 | 1 |
| 2025-06-09 | 98.5610 | 1 |
| 2025-06-10 | 98.5610 | 1 |
| 2025-06-11 | 100.8660 | 1 |
| 2025-06-12 | 100.8660 | 1 |
| 2025-06-13 | 100.8660 | 1 |
| 2025-06-16 | 100.8660 | 1 |
| 2025-06-17 | 100.8660 | 1 |
| 2025-06-18 | 100.8660 | 1 |
| 2025-06-20 | 100.8660 | 1 |
| 2025-06-23 | 100.8660 | 1 |
| 2025-06-24 | 101.5010 | 1 |
| 2025-06-25 | 101.7700 | 1 |
| 2025-06-26 | 101.7700 | 1 |
| 2025-06-27 | 101.7700 | 1 |
| 2025-06-30 | 103.4280 | 1 |
| 2025-07-01 | 103.4280 | 1 |
| 2025-07-02 | 103.4280 | 1 |
| 2025-07-03 | 104.5800 | 1 |
| 2025-07-07 | 105.2600 | 1 |
| 2025-07-08 | 105.2600 | 1 |
| 2025-07-09 | 105.2600 | 1 |
| 2025-07-10 | 105.2600 | 1 |
| 2025-07-11 | 105.2600 | 1 |
| 2025-07-14 | 105.2600 | 1 |
| 2025-07-15 | 105.2600 | 1 |
| 2025-07-16 | 106.1030 | 1 |
| 2025-07-17 | 111.9420 | 1 |
| 2025-07-18 | 112.7850 | 1 |
| 2025-07-21 | 114.7670 | 1 |
| 2025-07-22 | 114.7670 | 1 |
| 2025-07-23 | 114.7670 | 1 |
| 2025-07-24 | 114.7670 | 1 |
| 2025-07-25 | 114.7670 | 1 |
| 2025-07-28 | 114.7670 | 1 |
| 2025-07-29 | 114.7670 | 1 |
| 2025-07-30 | 114.7670 | 1 |
| 2025-07-31 | 114.7670 | 1 |
| 2025-08-01 | 114.7670 | 1 |
| 2025-08-04 | 114.7670 | 1 |
| 2025-08-05 | 114.7670 | 1 |
| 2025-08-06 | 133.4300 | 1 |
| 2025-08-07 | 133.4300 | 1 |
| 2025-08-08 | 133.4300 | 1 |
| 2025-08-11 | 133.4300 | 1 |
| 2025-08-12 | 133.4300 | 1 |
| 2025-08-13 | 133.4300 | 1 |
| 2025-08-14 | 133.4300 | 1 |
| 2025-08-15 | 133.4300 | 1 |
| 2025-08-18 | 133.4300 | 1 |
| 2025-08-19 | 133.4300 | 1 |
| 2025-08-20 | 133.4300 | 1 |
| 2025-08-21 | 133.4300 | 1 |
| 2025-08-22 | 133.4300 | 1 |
| 2025-08-25 | 133.4300 | 1 |
| 2025-08-26 | 133.4300 | 1 |
| 2025-08-27 | 133.4300 | 1 |
| 2025-08-28 | 133.4300 | 1 |
| 2025-08-29 | 133.4300 | 1 |
| 2025-09-02 | 133.4300 | 1 |
| 2025-09-03 | 133.4300 | 1 |
| 2025-09-04 | 133.4300 | 1 |
| 2025-09-05 | 133.4300 | 1 |
| 2025-09-08 | 133.4300 | 1 |
| 2025-09-09 | 133.4300 | 1 |
| 2025-09-10 | 133.4300 | 1 |
| 2025-09-11 | 133.4300 | 1 |
| 2025-09-12 | 133.4300 | 1 |
| 2025-09-15 | 134.0770 | 1 |
| 2025-09-16 | 134.0770 | 1 |
| 2025-09-17 | 134.2210 | 1 |
| 2025-09-18 | 138.3080 | 1 |
| 2025-09-19 | 139.8640 | 1 |
| 2025-09-22 | 142.8670 | 1 |
| 2025-09-23 | 142.8670 | 1 |
| 2025-09-24 | 142.8670 | 1 |
| 2025-09-25 | 142.8670 | 1 |
| 2025-09-26 | 155.5190 | -1 |
| 2025-09-29 | 155.5190 | -1 |
| 2025-09-30 | 155.5190 | -1 |
| 2025-10-01 | 155.5190 | -1 |
| 2025-10-02 | 155.5190 | -1 |
| 2025-10-03 | 143.1690 | 1 |
| 2025-10-06 | 145.7610 | 1 |
| 2025-10-07 | 145.7610 | 1 |
| 2025-10-08 | 147.3050 | 1 |
| 2025-10-09 | 147.3050 | 1 |
| 2025-10-10 | 147.3050 | 1 |
| 2025-10-13 | 147.3050 | 1 |
| 2025-10-14 | 147.3050 | 1 |
| 2025-10-15 | 147.3050 | 1 |
| 2025-10-16 | 147.3050 | 1 |
| 2025-10-17 | 147.3050 | 1 |
| 2025-10-20 | 147.3050 | 1 |
| 2025-10-21 | 147.3050 | 1 |
| 2025-10-22 | 147.3050 | 1 |
| 2025-10-23 | 148.0830 | 1 |
| 2025-10-24 | 153.5850 | 1 |
| 2025-10-27 | 156.3590 | 1 |
| 2025-10-28 | 160.0890 | 1 |
| 2025-10-29 | 160.2600 | 1 |
| 2025-10-30 | 160.2600 | 1 |
| 2025-10-31 | 160.2600 | 1 |
| 2025-11-03 | 160.2600 | 1 |
| 2025-11-04 | 160.2600 | 1 |
| 2025-11-05 | 160.2600 | 1 |
| 2025-11-06 | 179.0880 | -1 |
| 2025-11-07 | 175.8950 | -1 |
| 2025-11-10 | 175.8950 | -1 |
| 2025-11-11 | 175.8950 | -1 |
| 2025-11-12 | 175.8950 | -1 |
| 2025-11-13 | 169.4130 | -1 |
| 2025-11-14 | 169.4130 | -1 |
| 2025-11-17 | 163.1730 | -1 |
| 2025-11-18 | 163.1730 | -1 |
| 2025-11-19 | 163.1730 | -1 |
| 2025-11-20 | 163.1730 | -1 |
| 2025-11-21 | 163.1730 | -1 |
| 2025-11-24 | 163.1730 | -1 |
| 2025-11-25 | 163.1730 | -1 |
| 2025-11-26 | 163.1730 | -1 |
| 2025-11-28 | 163.1730 | -1 |
| 2025-12-01 | 163.1730 | -1 |
| 2025-12-02 | 163.1730 | -1 |
| 2025-12-03 | 163.1730 | -1 |
| 2025-12-04 | 163.1730 | -1 |
| 2025-12-05 | 163.1730 | -1 |
| 2025-12-08 | 163.1730 | -1 |
| 2025-12-09 | 163.1730 | -1 |
| 2025-12-10 | 147.2580 | 1 |
| 2025-12-11 | 147.2580 | 1 |
| 2025-12-12 | 147.2580 | 1 |
| 2025-12-15 | 147.2580 | 1 |
| 2025-12-16 | 147.2580 | 1 |
| 2025-12-17 | 147.2580 | 1 |
| 2025-12-18 | 147.2580 | 1 |
| 2025-12-19 | 147.2580 | 1 |
| 2025-12-22 | 148.4540 | 1 |
| 2025-12-23 | 149.6080 | 1 |
| 2025-12-24 | 150.8360 | 1 |
| 2025-12-26 | 153.1870 | 1 |
| 2025-12-29 | 153.1870 | 1 |
| 2025-12-30 | 153.1870 | 1 |
| 2025-12-31 | 153.1870 | 1 |
250 rows
References
- Paper Wilder, J.W. Jr. (1978). “New Concepts in Technical Trading Systems.” Trend Research (the Volatility System).
- Paper Vervoort, S. (2009). “Average True Range Trailing Stops.” Technical Analysis of Stocks & Commodities, 27(6), 34-40.
- Library Shares similar logic as pandas-ta’s atrts (ATR Trailing Stop)