Page 1 of 3

Chandelier Exit Indicators

Posted: Fri May 27, 2022 10:59 pm
by ionone
Chandelier Exit

I've seen this TradingView Indicator used a lot recently, from Alex Orekhov (everget), notably with Length: 1 & Multiplier: 2.5 settings and I must say this indicator is really good,
But unfortunately I was unable to find a good MT4 indicator that replicate the original perfectly, most of the indis i've found aren't the same and/or are broken

so here it is guys, a true version I made, identical to TV original (I verified visually)

enjoy

Jeff

Code: Select all

//@version=4
// Copyright (c) 2019-present, Alex Orekhov (everget)
// Chandelier Exit script may be freely distributed under the terms of the GPL-3.0 license.
study("Chandelier Exit", shorttitle="CE", overlay=true)

length = input(title="ATR Period", type=input.integer, defval=22)
mult = input(title="ATR Multiplier", type=input.float, step=0.1, defval=3.0)
showLabels = input(title="Show Buy/Sell Labels ?", type=input.bool, defval=true)
useClose = input(title="Use Close Price for Extremums ?", type=input.bool, defval=true)
highlightState = input(title="Highlight State ?", type=input.bool, defval=true)

atr = mult * atr(length)

longStop = (useClose ? highest(close, length) : highest(length)) - atr
longStopPrev = nz(longStop[1], longStop) 
longStop := close[1] > longStopPrev ? max(longStop, longStopPrev) : longStop

shortStop = (useClose ? lowest(close, length) : lowest(length)) + atr
shortStopPrev = nz(shortStop[1], shortStop)
shortStop := close[1] < shortStopPrev ? min(shortStop, shortStopPrev) : shortStop

var int dir = 1
dir := close > shortStopPrev ? 1 : close < longStopPrev ? -1 : dir

var color longColor = color.green
var color shortColor = color.red

longStopPlot = plot(dir == 1 ? longStop : na, title="Long Stop", style=plot.style_linebr, linewidth=2, color=longColor)
buySignal = dir == 1 and dir[1] == -1
plotshape(buySignal ? longStop : na, title="Long Stop Start", location=location.absolute, style=shape.circle, size=size.tiny, color=longColor, transp=0)
plotshape(buySignal and showLabels ? longStop : na, title="Buy Label", text="Buy", location=location.absolute, style=shape.labelup, size=size.tiny, color=longColor, textcolor=color.white, transp=0)

shortStopPlot = plot(dir == 1 ? na : shortStop, title="Short Stop", style=plot.style_linebr, linewidth=2, color=shortColor)
sellSignal = dir == -1 and dir[1] == 1
plotshape(sellSignal ? shortStop : na, title="Short Stop Start", location=location.absolute, style=shape.circle, size=size.tiny, color=shortColor, transp=0)
plotshape(sellSignal and showLabels ? shortStop : na, title="Sell Label", text="Sell", location=location.absolute, style=shape.labeldown, size=size.tiny, color=shortColor, textcolor=color.white, transp=0)

midPricePlot = plot(ohlc4, title="", style=plot.style_circles, linewidth=0, display=display.none, editable=false)

longFillColor = highlightState ? (dir == 1 ? longColor : na) : na
shortFillColor = highlightState ? (dir == -1 ? shortColor : na) : na
fill(midPricePlot, longStopPlot, title="Long State Filling", color=longFillColor)
fill(midPricePlot, shortStopPlot, title="Short State Filling", color=shortFillColor)

changeCond = dir != dir[1]
alertcondition(changeCond, title="Alert: CE Direction Change", message="Chandelier Exit has changed direction!")
alertcondition(buySignal, title="Alert: CE Buy", message="Chandelier Exit Buy!")
alertcondition(sellSignal, title="Alert: CE Sell", message="Chandelier Exit Sell!")

Re: Chandelier Exit Indicators

Posted: Fri May 27, 2022 11:25 pm
by ionone
And here is a version that uses a Moving Average as input instead of raw price. Can simulate and have the same result as if it was applied to a heiken ashi chart (as many of the strategies i've seen)

Re: Chandelier Exit Indicators

Posted: Sat May 28, 2022 1:04 am
by Deez
ionone wrote: Fri May 27, 2022 10:59 pm Chandelier Exit

I've seen this TradingView Indicator used a lot recently, from Alex Orekhov (everget), notably with 1,2.5 settings and I must say this indicator is really good,
But unfortunately I was unable to find a good MT4 indicator that replicate the original perfectly, most of the indis i've found aren't the same and/or are broken

so here it is guys, a true version I made, identical to TV original (I verified visually)

enjoy

Jeff

Code: Select all

//@version=4
// Copyright (c) 2019-present, Alex Orekhov (everget)
// Chandelier Exit script may be freely distributed under the terms of the GPL-3.0 license.
study("Chandelier Exit", shorttitle="CE", overlay=true)

length = input(title="ATR Period", type=input.integer, defval=22)
mult = input(title="ATR Multiplier", type=input.float, step=0.1, defval=3.0)
showLabels = input(title="Show Buy/Sell Labels ?", type=input.bool, defval=true)
useClose = input(title="Use Close Price for Extremums ?", type=input.bool, defval=true)
highlightState = input(title="Highlight State ?", type=input.bool, defval=true)

atr = mult * atr(length)

longStop = (useClose ? highest(close, length) : highest(length)) - atr
longStopPrev = nz(longStop[1], longStop) 
longStop := close[1] > longStopPrev ? max(longStop, longStopPrev) : longStop

shortStop = (useClose ? lowest(close, length) : lowest(length)) + atr
shortStopPrev = nz(shortStop[1], shortStop)
shortStop := close[1] < shortStopPrev ? min(shortStop, shortStopPrev) : shortStop

var int dir = 1
dir := close > shortStopPrev ? 1 : close < longStopPrev ? -1 : dir

var color longColor = color.green
var color shortColor = color.red

longStopPlot = plot(dir == 1 ? longStop : na, title="Long Stop", style=plot.style_linebr, linewidth=2, color=longColor)
buySignal = dir == 1 and dir[1] == -1
plotshape(buySignal ? longStop : na, title="Long Stop Start", location=location.absolute, style=shape.circle, size=size.tiny, color=longColor, transp=0)
plotshape(buySignal and showLabels ? longStop : na, title="Buy Label", text="Buy", location=location.absolute, style=shape.labelup, size=size.tiny, color=longColor, textcolor=color.white, transp=0)

shortStopPlot = plot(dir == 1 ? na : shortStop, title="Short Stop", style=plot.style_linebr, linewidth=2, color=shortColor)
sellSignal = dir == -1 and dir[1] == 1
plotshape(sellSignal ? shortStop : na, title="Short Stop Start", location=location.absolute, style=shape.circle, size=size.tiny, color=shortColor, transp=0)
plotshape(sellSignal and showLabels ? shortStop : na, title="Sell Label", text="Sell", location=location.absolute, style=shape.labeldown, size=size.tiny, color=shortColor, textcolor=color.white, transp=0)

midPricePlot = plot(ohlc4, title="", style=plot.style_circles, linewidth=0, display=display.none, editable=false)

longFillColor = highlightState ? (dir == 1 ? longColor : na) : na
shortFillColor = highlightState ? (dir == -1 ? shortColor : na) : na
fill(midPricePlot, longStopPlot, title="Long State Filling", color=longFillColor)
fill(midPricePlot, shortStopPlot, title="Short State Filling", color=shortFillColor)

changeCond = dir != dir[1]
alertcondition(changeCond, title="Alert: CE Direction Change", message="Chandelier Exit has changed direction!")
alertcondition(buySignal, title="Alert: CE Buy", message="Chandelier Exit Buy!")
alertcondition(sellSignal, title="Alert: CE Sell", message="Chandelier Exit Sell!")
Image
Really good indicator - think you can make it MTF?

Re: Chandelier Exit Indicators

Posted: Sat May 28, 2022 1:13 am
by HeavLeighGill
Thanks so much for posting!

Re: Chandelier Exit Indicators

Posted: Sat May 28, 2022 4:56 pm
by ionone
Deez wrote: Sat May 28, 2022 1:04 am Really good indicator - think you can make it MTF?
I never made a MTF indicator yet as I think it's repainting the price. Better ask MrTools to do his magic on this indicator

Re: Chandelier Exit Indicators

Posted: Sat May 28, 2022 8:06 pm
by ionone
new version where you can select the bar you want the Alerts On, being 0 if you want alerts during latest bar, but when signals will be different if you refresh chart or put the indi back.
Select "Alerts on Close Only" if you want the exact same results as when you put the indi on chart, but have later signals, at the close of the bar

If you want same behaviour as version 1.0, set "Alerts on Close Only" to "false"
Jeff

Re: Chandelier Exit Indicators

Posted: Sun May 29, 2022 3:38 pm
by mrtools
Deez wrote: Sat May 28, 2022 1:04 am Really good indicator - think you can make it MTF?
Have this old version that's mtf, think it's kinda close to Ionone's version, will do a mtf of his version when i feel better.

Re: Chandelier Exit Indicators

Posted: Mon May 30, 2022 4:33 pm
by Dego
ionone wrote: Sat May 28, 2022 8:06 pm new version where you can select the bar you want the Alerts On, being 0 if you want alerts during latest bar, but when signals will be different if you refresh chart or put the indi back.
Select "Alerts on Close Only" if you want the exact same results as when you put the indi on chart, but have later signals, at the close of the bar

If you want same behaviour as version 1.0, set "Alerts on Close Only" to "false"
Jeff
Thank you.

On what timeframe did you notice best results?

Re: Chandelier Exit Indicators

Posted: Mon May 30, 2022 5:16 pm
by ionone
Dego wrote: Mon May 30, 2022 4:33 pm Thank you.

On what timeframe did you notice best results?
I think H1 has the best ratio profit/DD

Re: Chandelier Exit Indicators

Posted: Sat Jun 25, 2022 1:56 am
by ionone
Here is Chandelier MA 10.2 fixed (there was a bug in previous version)

I also made an Heiken Ashi version

I recommend settings 1, 2.0, false
regards,

Jeff