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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.