This board has been archived, no new registrations are allowed. Please come join us on our discord!

[Indicator or Safety] Candelier Exit

General discussion about the HaasScript Indicators, Safeties and Insurances
User avatar
Posts: 1047
Joined: Fri Sep 12, 2014 9:37 am

[Indicator or Safety] Candelier Exit

Postby stephan » Wed Sep 13, 2017 5:22 pm

Candelier Exit

There are several implementations of stop-losses, but in general, there are not so many special ones. The Chandelier Exit is the exception to this rule if you ask me.

This script uses the highest high and lowest low values combined with the ATR to calculate a stop-loss line. It also has the ability to produce buying signals, but those are less accurate for some strange reason.

The script
The following script is a copy and paste ready, so you can simply copy this script and paste it inside the script editor to make it work.

Code: Select all

v = Input('Length',22,1,99)    -- Inputfield, value 22, range 1-99
at = Input('ATR',22,1,99)    -- Inputfield, value 22, range 1-99
m = Input('Multiplier',5,2,99)

hp = GetHighPrices()
lp = GetLowPrices()
cp = GetPrices()

hv = GetHigh(hp, view);
lv = GetLow(lp, view);

p = cp[0]

y = ATR(hp, lp, cp, at);

x = m * y[0];

cl = hv - x
cs = lv + x

Plot('Price', p, 1, Yellow)
Plot('Long', cl, 1, Red)
Plot('Short', cs, 1, Green)

if (p <= cl) then
  LongBuy()                    -- Signal a buy/long

if (p >= cs) then
  ShortSell()                  -- Signal a sell/short

Signal properties
This indicator is called a stoploss for a reason. It is really perfect to decide when to sell your asset into spot trading or when to go short on leverage trading.

Learning reflection
When you look to the used logic then it is noticeable this shares some basic similarities with the ichimoku-cloud which also uses the highest high and lowest low. The ATR is used in this case as well and in this case, it is used as a weight to the lines. This weight setup here can be a good inspiration for other indicators.

Please feel free to leave a comment on how you like this script (or not) and how you think it can be improved.
Join the telegram group too:

Registered User
Posts: 10
Joined: Sat Feb 17, 2018 2:10 pm

Re: [Indicator or Safety] Candelier Exit

Postby mjmokhtari.tehran » Mon Mar 26, 2018 7:12 pm

This is what exactly I was searching for! Thanks.
But I have a question: Can I see effect of this safety after doing backtest? or same as some other script safeties, this one is effective on forward testing (simulated) too?

Return to “HaasScript Indicators, Safeties and Insurances”

Who is online

Users browsing this forum: No registered users and 3 guests