Supertrend
A trailing line that sits under price in an uptrend and over it in a downtrend, plus the trend direction.
Supertrend takes the midpoint of each bar and adds and subtracts the multiplier times the average true range (Wilder-smoothed over atr_window bars) to form an upper and a lower band. While the close stays below the upper band, that band can only fall, and while it stays above the lower band, that band can only rise. The line is the lower band while direction is up (+1) and the upper band while it is down (-1), and direction flips when the close crosses the band the line is using.
How to read it
- While the line sits under the candles the trend is up; while it sits over them the trend is down.
- Each flip is a jump: the line leaps from one side of price to the other on the bar the trend changes, so the flip bars are the events to watch.
- The pane below shows direction, stepping between +1 (up) and -1 (down); it changes only on flip bars.
- A long run with no flip means price has stayed on one side of the moving band the whole time.
What it outputs
- Trailing line
- The Supertrend line: the lower band while direction is up, the upper band while it is down. It sits on the price scale and tracks the close closely, with correlation about 0.995 over the sample.
- Trend direction
- Trend direction: +1 while the trend is up, -1 while it is down. It changes only where the close crosses the band the line uses.
Settings
- ATR window
- Bars in the average true range that sets how far the bands sit from the midpoint. Lowering it lets the bands react within a few bars, so the line flips more often on volatile bars. Raising it smooths the bands and makes flips rarer and slower.
- Multiplier
- How many average true ranges the bands sit from the midpoint. Raising it widens the gap the close must cross before a flip, so the line flips less often and sits further from price. Lowering it pulls the line toward price so it flips on smaller moves.
Pitfalls
- The line jumps at every flip, from below price to above it or back, so a flip is a large visible move rather than a smooth change.
- The sample month of SPY one-minute bars was mostly up (median direction +1, p95 +1), so the default view shows one regime. In a choppy session a short ATR window can flip the line on noise.
- The first few bars have no value until the ATR window fills; at default settings about 0.04 percent of the sample bars are blank.