Chandelier Exit Indicator: ATR Trailing Stop for MT4 and MT5

Written by Dominic Walsh · Published · Last updated

The chandelier exit indicator hangs a trailing stop from the highest high or the lowest low of a lookback window, measured in ATR. Chuck LeBeau’s original idea said a stop should follow the extreme of a move rather than the current price. This build draws both sides of that calculation and marks the bar where the stop changes sides.

This build ships as a compiled .ex4 for MT4 and .ex5 for MT5; the screenshots below come from EURUSD H1.

Platforms MT4 (.ex4) + MT5 (.ex5)
Chart window Main price chart
Plots 4: LongStop, ShortStop, BuyFlip, SellFlip
Alerts popup
Inputs 4

What the Chandelier Exit Indicator draws on the chart

LongStop runs as a lime line below price, taken from the highest high minus a multiple of ATR.

ShortStop runs as the red counterpart above price, from the lowest low plus that same multiple.

BuyFlip drops a lime arrow under the bar where direction turns up.

SellFlip places a red arrow above the bar where direction turns down.

  • LongStop: line, lime, width 2
  • ShortStop: line, red, width 2
  • BuyFlip: arrow, lime, width 2, arrow code 233
  • SellFlip: arrow, red, width 2, arrow code 234
Chandelier exit indicator on EURUSD H1 with LongStop, ShortStop and the flip arrows
Chandelier exit indicator on EURUSD H1 with LongStop, ShortStop and the flip arrows

How the Chandelier Exit Indicator calculates its values

Anchoring to the recent extreme

Each bar the code calls iHighest and iLowest over the last `ChPeriod` bars to find hh and ll. Those two values anchor everything else. The current close plays no part in this step, which keeps one spike in the wrong direction from dragging the stop around.

Offsetting by volatility

An ATR reading over the same `ChPeriod` window meets `ChMult`. The code subtracts that product from hh to get longStop, or adds it to ll for shortStop. Quiet markets keep both lines close to price. Wider ranges move the lines back. The same settings therefore behave differently in different conditions, without you touching them.

Ratcheting and the flip

A stop that loosens is not a stop, so the code checks the previous bar. While close[i+1] holds above prevLong, longStop takes MathMax of the new value and the old one, so it can rise but never fall. shortStop ratchets the other way through MathMin. Direction changes when close[i] drops below prevLong in an uptrend, or clears prevShort in a downtrend. That bar then gets an arrow, `ArrowOffset` points clear of the candle.

How to read the signals

Only one of the two lines does any work at a time. The active one is the side price has not broken.

A rising LongStop under price says the up move still holds by the tool’s own rule.

The arrow is the event, not the line. Everything before it is the stop simply following along.

Flat stretches mean the ratchet is holding an older level, because the new calculation came out looser.

Alert channels in this build: popup, one message per closed bar.

`EnableAlert` ships on and raises a terminal popup when direction flips. This build carries no other channel. The guard allows one message per closed bar, so an intrabar wobble across the line stays quiet.

Every Chandelier Exit Indicator input

Core settings

Setting What it does Default
ChPeriod ATR + Highest/Lowest lookback. Sets the lookback for both the extreme and the ATR, default `22`. Shorten it for a stop that reacts faster and flips more often. 22
ChMult ATR multiplier. The ATR multiple, default `3.0`. Under 2.0 the stop hugs price and flips constantly. Above 4.0 it rarely triggers at all. 3.0

Display settings

Setting What it does Default
ArrowOffset arrow offset in points. Sets the gap in points between candle and flip arrow, default `10`. 10

Alert settings

Setting What it does Default
EnableAlert alert on flip. on
Chandelier exit indicator inputs panel showing ChPeriod, ChMult and ArrowOffset
Chandelier exit indicator inputs panel showing ChPeriod, ChMult and ArrowOffset

Settings that fit your chart

This suits anything with a usable ATR, which covers major and minor forex pairs, metals and indices. The screenshot note names EURUSD H1 as the reference chart. Because the calculation scales with volatility, the same 22 and 3.0 pair travels between instruments better than a fixed pip stop. A 22-bar window still means something very different on M5 than on D1.

When the Chandelier Exit Indicator fails

Sideways markets flip the direction back and forth. The tool follows trends and carries no filter to tell it when none exists.

The ratchet only tightens, so after a sharp reversal the stop can sit far away until the flip finally arrives, giving back much of the move.

ATR responds to a volatility spike with a lag, so a news candle can widen the stop just as the move it tracked ends.

Copy the compiled Chandelier Exit Indicator file into your MQL4/Indicators folder, and the MT5 build into MQL5/Indicators, then restart the terminal and drag it onto a chart. The step-by-step guide with screenshots is at how to install MT4 and MT5 indicators.

Download the Chandelier Exit Indicator for MT4 and MT5

The zip holds the compiled Chandelier Exit Indicator build for MT4 and MT5, plus a short README. Compiled files only, no source. Enter your email below and the download link arrives in your inbox.

Download this indicator free

Enter your email and the file is yours. You also get the full MT4 and MT5 library.

  • 1,380+ indicators
  • MT4 and MT5 files
  • No spam, unsubscribe any time

FAQ

Why does the LongStop line stay flat for many bars?

The ratchet blocks it from loosening. Each bar the code takes MathMax of the freshly calculated stop and the previous bar’s value. When the recent high has pulled back, or ATR has widened, the new number comes out lower, so the code holds the old level instead. That flat section is the stop refusing to give ground.

What does ChMult actually change?

It scales how far the stop sits from the recent extreme, as a multiple of ATR. The default `3.0` means three times the average range of the last 22 bars. Cut it to 2.0 and you will see far more BuyFlip and SellFlip arrows. Raise it and the arrows become rare.

Does the chandelier exit indicator repaint?

It builds both lines from completed bar data, and the ratchet only reads the previous bar’s stored value, so a printed level stays put. The bar still forming can change until it closes, which holds for any bar-based calculation. Alerts wait for the close for exactly that reason.

Can I treat a BuyFlip arrow as an entry signal?

LeBeau designed this as an exit. BuyFlip and SellFlip mark the bar where the trailing stop changed sides, which usually happens once a move is already underway. Some traders read the flip as a trend filter instead, pairing it with a separate entry rule of their own.

Are results guaranteed?

No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Chandelier Exit Indicator as one input. Always backtest before trading live.

Category: this is part of our Signal and Forecast collection. Also, truly, browse more Signal and Forecast for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.

External references

Dominic Walsh - Forex trader and MT4/MT5 developer

About the author

Written by Dominic Walsh, a Forex trader and MT4/MT5 indicator, Expert Advisor and script developer. Every tool on forexmt4systems.com is tested on live charts before release and ships with ready-to-use compiled MT4 (.ex4) and MT5 (.ex5) files. Learn more about the trader and developer behind this site.

How we build, test and correct every tool: Editorial & Testing Policy. Trading carries risk; see the disclaimer.

Leave a Comment