Chandelier Exit
get_chandelier(quotes, lookback_periods=22, multiplier=3.0, chandelier_type=ChandelierType.LONG)
Parameters
name | type | notes |
---|---|---|
quotes | Iterable[Quote] | Iterable of the Quote class or its sub-class. • See here for usage with pandas.DataFrame |
lookback_periods | int, default 22 | Number of periods (N ) for the lookback evaluation. |
multiplier | float, default 3.0 | Multiplier number must be a positive value. |
chandelier_type | ChandelierType, default ChandelierType.LONG | Direction of exit. See ChandelierType options below. |
Historical quotes requirements
You must have at least N+1
periods of quotes
to cover the warmup periods.
quotes
is an Iterable[Quote]
collection of historical price quotes. It should have a consistent frequency (day, hour, minute, etc). See the Guide for more information.
ChandelierType options
from stock_indicators.indicators.common.enums import ChandelierType
type | description |
---|---|
LONG | Intended as stop loss value for long positions. (default) |
SHORT | Intended as stop loss value for short positions. |
Return
ChandelierResults[ChandelierResult]
- This method returns a time series of all available indicator values for the
quotes
provided. ChandelierResults
is just a list ofChandelierResult
.- It always returns the same number of elements as there are in the historical quotes.
- It does not return a single incremental indicator value.
- The first
N
periods will haveNone
Chandelier values since there’s not enough data to calculate.
ChandelierResult
name | type | notes |
---|---|---|
date | datetime | Date |
chandelier_exit | float, Optional | Exit line |
Utilities
See Utilities and Helpers for more information.
Example
from stock_indicators import indicators
from stock_indicators import ChandelierType # Short path, version >= 0.8.1
# This method is NOT a part of the library.
quotes = get_historical_quotes("SPY")
# calculate Chandelier(22,3)
results = indicators.get_chandelier(quotes, 22, 3, ChandelierType.LONG)
About Chandelier Exit
Created by Charles Le Beau, the Chandelier Exit is typically used for stop-loss and can be computed for both long or short types. [Discuss] 💬