Struct ta::indicators::ChandelierExit [−][src]
pub struct ChandelierExit { /* fields omitted */ }
Expand description
Chandelier Exit (CE).
Developed by Charles Le Beau and featured in Alexander Elder’s books, the Chandelier Exit sets a trailing stop-loss based on the Average True Range (ATR). The indicator is designed to keep traders in a trend and prevent an early exit as long as the trend extends. Typically, the Chandelier Exit will be above prices during a downtrend and below prices during an uptrend.
Formula
Chandelier Exit (long) = Max(period) - ATR(period) * multipler Chandelier Exit (short) = Min(period) + ATR(period) * multipler
Parameters
- period - number of periods (integer greater than 0). Default is 22.
- multipler - ATR factor. Default is 3.
Example
use ta::indicators::ChandelierExit; use ta::{Next, DataItem}; let value1 = DataItem::builder() .open(21.0).high(22.0).low(20.0).close(21.0).volume(1.0).build().unwrap(); let value2 = DataItem::builder() .open(23.0).high(24.0).low(22.0).close(23.0).volume(1.0).build().unwrap(); let mut ce = ChandelierExit::default(); let first = ce.next(&value1); assert_eq!(first.long, 16.0); assert_eq!(first.short, 26.0); let second = ce.next(&value2); assert_eq!((second.long * 100.0).round() / 100.0, 17.74); assert_eq!((second.short * 100.0).round() / 100.0, 26.26);
Links
Implementations
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for ChandelierExit
impl Send for ChandelierExit
impl Sync for ChandelierExit
impl Unpin for ChandelierExit
impl UnwindSafe for ChandelierExit
Blanket Implementations
Mutably borrows from an owned value. Read more