Smart Chandelier Exit
- 指标
-
Bugra Kaan Yildirim
info@algoteknik.com - 版本: 1.0
Smart Chandelier Exit
Smart Chandelier Exit is an adaptive trailing-stop and trend-direction indicator. It plots a neon-glow stop line that follows price: emerald-green below price in an uptrend, crimson-red above price in a downtrend. The line only ever ratchets in the trend's favor, never against it, so it doubles as a mechanical stop-loss and a trend-state signal.
What makes it "smart" is the built-in Pearson R trend-quality filter. A raw stop line tells you WHERE the stop is; the Pearson R engine tells you HOW GOOD the current trend actually is (strong, moderate, weak, or just ranging noise). Both are shown together on a compact on-chart panel, along with rolling statistics that separate genuine trend flips from short-lived "fake" flips.
The indicator is non-repainting: the stop line is computed on closed bars with a one-directional ratchet, alerts fire only on a closed bar, and flip arrows are confirmed after a fixed number of bars (so an arrow never appears and then disappears). What you see in history is what you would have seen live.
What you see on the chart
1. Neon glow stop lines
The active stop direction is rendered as three stacked lines for a premium neon-glow look:
- Outer glow (width 5, very faint) — background halo
- Inner glow (width 3, medium) — mid corona
- Core line (width 1, bright) — the precise stop level
Color shifts automatically with the Pearson R regime:
- Bright Emerald — Strong UP
- Soft Green — Moderate UP
- Amber — Weak trend
- Cool Gray — Ranging / no trend
- Soft Red — Moderate DOWN
- Bright Crimson — Strong DOWN
Only the active direction's glow is shown. The passive side (inactive stop) is completely hidden so the chart stays clean.
2. Fill band (shadow zone)
A subtle shaded band approximately 0.4 × ATR wide hugs the active stop line: dark green shadow below the bullish stop line, dark red shadow above the bearish stop line. This gives an instant visual depth cue showing where the "danger zone" is relative to the current price.
3. Flip arrows (optional, InpShowFlips)
- Green up-arrow below the bar: confirmed flip to bullish.
- Red down-arrow above the bar: confirmed flip to bearish.
- Arrows are drawn only after the flip has maintained its direction continuously for InpFakeFlipBars bars. This confirmation delay filters out flips that reverse intra-window, guaranteeing the arrow is non-repainting.
- Arrow width encodes trend quality at the moment of the flip: 3px when |R| ≥ Strong level, 2px when |R| ≥ Moderate level, 1px otherwise. A small R-value label is printed next to each arrow.
- Important: there is no Pearson R threshold for whether an arrow appears — every flip that survives the confirmation window gets an arrow, even during a ranging regime. Width and the R label are the only cues to flip quality.
- Only the most recent InpMaxArrows arrows are kept on the chart to avoid chart-object bloat. Set InpMaxArrows to 0 to keep every arrow.
4. Info panel (optional, InpShowPanel)
A compact on-chart dashboard placed in the corner selected by InpPanelCorner, offset by InpCornerX / InpCornerY pixels, with a pulsing LIVE badge and three sections: SETUP, EXECUTION, INSIGHTS.
The panel, row by row
SETUP — Pearson R (−1.0 to +1.0) with a 10-segment strength bar, a plain-language Regime label (Strong / Moderate / Weak / Ranging, Up or Down), and the ATR period / multiplier the stop was drawn with.
EXECUTION — Direction, the exact active Stop Level price, and Distance to that stop in your chosen unit plus ATR risk units ("R"). On short trades the spread is added to the price first, because the close is the Bid while a short stop is triggered on the Ask.
Two different "R" readings on this panel: the "R" inside Distance is the stop distance measured in ATR units (risk); the "Pearson R" row is the trend-quality correlation coefficient. They are unrelated.
INSIGHTS — Fake Flips is the share of the last 50 flips that reversed within the confirmation window (LOW < 20%, MED 20–40%, HIGH > 40%), shown with a risk-thermometer bar. Bars Since counts how long the current direction has been active.
How direction and the stop are computed
- Long stop = Highest High (Lookback) − ATR × Multiplier
- Short stop = Lowest Low (Lookback) + ATR × Multiplier
- The active long stop only moves up; the active short stop only moves down (one-directional ratchet).
- Direction flips to UP when the close crosses above the short stop, and to DOWN when the close crosses below the long stop. Only the stop for the current direction is plotted.
Automated trading (EA integration)
The indicator exposes two hidden data buffers for EA developers to read via iCustom:
- Buffer 10 (CE Direction): 1 for Bullish (Long SL active), −1 for Bearish (Short SL active).
- Buffer 11 (CE Pearson R): the exact Pearson R correlation value (−1.0 to +1.0).
An EA can trade on direction flips while filtering out weak signals where |R| is low.
Input parameters
| Group | Parameter | Default | Description |
|---|---|---|---|
| CE Parameters | ATR Period | 22 | ATR period used to size the stop distance |
| Lookback | 22 | Bars used for the highest-high / lowest-low the stop is measured from | |
| ATR Multiplier | 3.0 | Larger = wider stop, fewer flips | |
| Pearson R (Trend Quality) | R Period | 22 | Lookback for the price-vs-time correlation |
| Strong Level | 0.7 | |R| at/above this = "Strong" regime | |
| Moderate Level | 0.5 | |R| at/above this = "Moderate" regime (Weak floor is fixed at 0.3) | |
| Fake Flip Detection | Fake Flip Bars | 5 | A flip reversing within this many bars is tagged FAKE; also the arrow confirmation delay |
| Performance & Limits | Max Bars | 5000 | Max bars processed on calculation (0 = all history) |
| Max Arrows | 100 | Max flip arrows kept on chart (0 = all) | |
| Visual | Show Panel | true | Show/hide the info panel |
| Show Flips | true | Show/hide confirmed flip arrows | |
| Panel Corner | Top Left | Panel corner position | |
| Panel Theme | Dark Obsidian | Dark Obsidian / Cyberpunk Neon / Midnight Blue | |
| Corner X / Y | 20 / 20 | Panel offset from the selected corner (px) | |
| Distance Unit | Auto | Auto = pips for Forex, raw price difference for indices/crypto/shares | |
| Alerts | Alert On Flip | false | Pop-up alert on a confirmed direction flip |
| Push On Flip | false | Mobile push notification (requires a MetaQuotes ID configured in the terminal) | |
| Mail On Flip | false | Email alert on a confirmed direction flip |
Suggested use
- Trend direction / bias: trade in the direction of the active glow line.
- Regime quality: prefer signals when the panel reads Strong or Moderate in the trade direction.
- Trailing stop: use the core stop line as a mechanical stop that never loosens.
- Flip trust: read the Fake Flips thermometer together with the Regime row before acting on a fresh arrow.
Works on any symbol and timeframe. Default parameters (22/22/3.0) are a classic starting point; tune the ATR multiplier and lookback to the volatility of your instrument and timeframe.
This is an indicator for analysis and decision support. It does not place trades. Trading involves risk.


Fire!!!