--edit: appears I can’t spell and I am unable to fix the title.
Hi all, looking to implement Chandeliers exit https://school.stockcharts.com/doku.php?id=technical_indicators:chandelier_exit
Which is this:
Chandelier Exit (long) = 22-day High - ATR(22) x 3
Chandelier Exit (short) = 22-day Low + ATR(22) x 3
I am fine with ATR but need some help with keeping track of the high’s and low’s for the last 22 candles.
nerdy You mean you need the high price of the last 22 bars?
Use talib MIN / MAX http://mrjbq7.github.io/ta-lib/func_groups/math_operators.html or numpys min max (here you need to use the NumPy Array Slicing to check only the last 22 candles).
Saleh Yes, didn’t have a chance to work on this last night. For this indicator I need to track the highest high over the last ‘x’ candles and lowest low over the last ‘x’ candles.
nerdy Here's how I do it:
# highest of the last 20 bars
last_20_highs = self.candles[-20:, 3]
previous_high = np.max(last_20_highs)
# lowest of the 20 bars
last_20_lows = self.candles[-20:, 4]
previous_low = np.min(last_20_lows)