[−][src]Struct ta::indicators::ChandelierExit
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
impl ChandelierExit
[src]
Trait Implementations
impl Clone for ChandelierExit
[src]
fn clone(&self) -> ChandelierExit
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for ChandelierExit
[src]
impl Default for ChandelierExit
[src]
impl Display for ChandelierExit
[src]
impl<T: Low + High + Close, '_> Next<&'_ T> for ChandelierExit
[src]
impl Period for ChandelierExit
[src]
impl Reset for ChandelierExit
[src]
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,