Explainers / Chandelier Exit
Chandelier Exit by everget, explained from its source
The Chandelier Exit by everget is one of the most-used free indicators on TradingView, with about a million views. It draws a trailing stop line under price in an uptrend and over price in a downtrend, and flips between the two. This page explains it from the published source code, including one default most formula pages get wrong: out of the box it hangs the stop from the highest close, not the highest high.
The formula
Two lines are calculated on every bar. Only one is drawn at a time.
- Long stop: the highest value of the last 22 bars, minus 3 times the 22-bar ATR.
- Short stop: the lowest value of the last 22 bars, plus 3 times the 22-bar ATR.
long stop = highest(22) - 3 x ATR(22) and short stop = lowest(22) + 3 x ATR(22)
ATR here is Wilder's average true range, the same one TradingView's built-in ATR uses.
The name comes from the picture: the stop hangs down from the highest point, like a chandelier from a ceiling.
The default most pages miss: closes, not highs
The classic description of the Chandelier Exit uses the highest high and lowest low. This script has a setting called "Use Close Price for Extremums", and it is on by default. So unless you change it, the stop hangs from the highest close of the last 22 bars.
Why it matters:
- The highest close is never above the highest high, so the default long stop sits a little lower, further from price.
- A long upper wick that closes back down does not lift the stop.
- If you compare it with another platform or a formula from a book, the lines will not match until you turn this setting off.
In a simulation on 200,000 random bars, the high/low version flipped direction about 30% more often than the close version, because its stop sits closer to price. That says nothing about which is better. It tells you the two settings are different tools.
How the stop trails and flips
- Trailing: while price stays above the long stop, the stop is allowed to rise but not fall. The short stop mirrors this on the way down.
- Flip to long: when the close goes above the previous short stop.
- Flip to short: when the close goes below the previous long stop.
- At each flip the script draws a small circle and, by default, a "Buy" or "Sell" label.
One detail from the code: the "rise but not fall" rule checks the previous close against the previous stop. In rare cases price slips between the two without flipping, and the long stop steps down for a bar. In our simulation that happened on about 0.3% of long bars with the default setting. So the stop almost always only moves in your direction, not always.
Does Chandelier Exit repaint?
Not on closed bars. Every value uses the current and past bars only. There is no higher-timeframe request and no look into the future.
The live bar does change, and this matters more here than for most indicators:
- The flip test uses the current close. Mid-bar, price can cross the stop, the line can switch sides and a "Buy" or "Sell" label can appear, then vanish if price comes back before the bar closes.
- The script's alerts have an "Await Bar Confirmation" setting that is on by default, so the alerts wait for the close. The labels on the chart do not wait. What you see on the live bar is provisional.
If you want to test an indicator's behaviour yourself, see the free repaint checker.
Chandelier Exit vs Supertrend
They look alike: one line, flipping sides, built on ATR. They hang from different places.
| Chandelier Exit (everget defaults) | Supertrend (TradingView built-in defaults) | |
|---|---|---|
| Anchor | Highest / lowest close of 22 bars | The bar's midpoint, (high + low) / 2 |
| Distance | 3 x ATR(22) | 3 x ATR(10) |
| After a strong run | Stop trails from the peak of the window | Stop trails from the current bar's middle, ratcheted |
| Window memory | A spike stays in the window for 22 bars | No window of extremes |
In plain terms: the Chandelier Exit measures how far price has fallen from its recent best. Supertrend measures how far it is from the middle of the current bar. More on that one at Supertrend explained.
Settings, honestly
There is no "best" setting for gold, scalping or intraday. What each one does:
- ATR Period (22): both the ATR length and the window for the highest and lowest values. Shorter reacts faster and flips more.
- ATR Multiplier (3.0): the distance from the extreme. Smaller keeps the stop tighter and flips more often. Larger flips less and gives back more before it flips.
- Use Close Price for Extremums (on): closes instead of highs and lows, see above.
- Show Buy/Sell Labels (on): labels at each flip. They are flip markers, not trade instructions.
- Highlight State (on): the shaded fill between price and the stop.
- Await Bar Confirmation (on): applies to alerts only, not to the labels.
On a 1-minute chart, 22 bars is 22 minutes. On a daily chart it is about a month. The same numbers mean different things on each timeframe.
Where it fails
- Sideways markets. When price chops around a flat range, the close crosses the stop back and forth and the line flips again and again.
- Gaps. The stop is checked on the close. A gap through it means the exit you would actually get is wherever the market opens, not the line.
- A spike lingers. One extreme bar sets the anchor for the next 22 bars, even after price has moved on.
- The live bar. Labels can appear and disappear before the bar closes.
- It is a stop rule, not a forecast. A flip says price moved a set distance from its recent extreme. It does not say where price goes next.
Also explained
Educational content only. Not financial advice. Nothing here is a recommendation to buy or sell anything. Original script by everget on TradingView (GPL-3.0); this page explains its published source and quotes no code.
Also explained: Repaint checker, VWAP, Supertrend, RSI, UT Bot Alerts, Nadaraya-Watson Envelope, Squeeze Momentum, What is repainting on TradingView?, Is TradingView backtesting accurate?, WaveTrend Oscillator, QQE MOD, Pivot highs and lows, Hull Suite, Range Filter, Twin Range Filter, HalfTrend, ZigZag++, SSL Hybrid, CM MacD Ultimate MTF, Volume Profile / Fixed Range, ADX and DI, Support Resistance Channels, Market Structure Break & Order Block, Order Block Finder, Pivot Point SuperTrend, Trendlines with Breaks [LuxAlgo], Divergence for Many Indicators, TradingView script selling terms, Support and Resistance Levels with Break, Liquidity Swings [LuxAlgo], Pine Script errors, Breakout Probability (Expo), Did ChatGPT or Claude write your Pine Sc, Lorentzian Classification, SuperTrend AI (Clustering), Machine Learning Adaptive SuperTrend, Dynamic Swing Anchored VWAP, Support and Resistance Power Channel by , Support and Resistance (High Volume Boxe, Trendline Breakouts With Targets by Char, Breakout Finder by LonesomeTheBlue
Get the next teardown by email
One short email when a new teardown or free tool goes live, about twice a month. No signals, no hype. Unsubscribe in one click.
Almost done. Check your inbox and click the confirmation link.
Sent with Kit. Your address is used only for these emails. Privacy
No TradingView account yet? This affiliate link gives you a $15 coupon toward a paid plan, and we earn a commission if you buy one. The free plan is enough to follow this page.