[][src]Struct ta::indicators::ChandelierExit

pub struct ChandelierExit { /* fields omitted */ }

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]

pub fn new(period: usize, multiplier: f64) -> Result<Self>[src]

pub fn multiplier(&self) -> f64[src]

Trait Implementations

impl Clone for ChandelierExit[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]

type Output = ChandelierExitOutput

impl Period for ChandelierExit[src]

impl Reset for ChandelierExit[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.