pub struct Adx { /* private fields */ }Expand description
Average Directional Index (ADX) with the directional indicators and a signal line.
From the second bar on, with up = high - prev_high and down = prev_low - low: +DM = up if
up > down and up > 0, else 0; -DM = down if down > up and down > 0, else 0; and
TR = max(high - low, |high - prev_close|, |low - prev_close|). TR, +DM and -DM are
Wilder-smoothed over di_len (Rma, seeded with the SMA of their first values):
DI+ = 100 * +DM_avg / TR_avg DI- = 100 * -DM_avg / TR_avg (0 for TR_avg = 0)
DX = 100 * |DI+ - DI-| / (DI+ + DI-) (0 for a zero sum)
ADX = Wilder average of DX over adx_smoothvalue: the ADX; extra["di_plus"], extra["di_minus"], and extra["signal"], an
Ema(sig_len) over the ADX with its first-sample seed. Alerts fire on DI crosses and when the
ADX crosses level_weak.
First output: once the DX average exists, i.e. with the di_len + adx_smooth-th bar.
Indicator::reset clears all averages.
Implementations§
Trait Implementations§
Source§impl Indicator for Adx
impl Indicator for Adx
fn name(&self) -> &str
fn warmup_period(&self) -> usize
fn on_bar(&mut self, bar: &Bar) -> Option<IndicatorOutput>
fn reset(&mut self)
fn alerts(&self) -> Vec<IndicatorAlert>
Source§fn on_checked_bar(
&mut self,
bar: &Bar,
) -> Result<Option<IndicatorOutput>, BarValidationError>
fn on_checked_bar( &mut self, bar: &Bar, ) -> Result<Option<IndicatorOutput>, BarValidationError>
Validates a bar before forwarding it to
Indicator::on_bar.Auto Trait Implementations§
impl Freeze for Adx
impl RefUnwindSafe for Adx
impl Send for Adx
impl Sync for Adx
impl Unpin for Adx
impl UnsafeUnpin for Adx
impl UnwindSafe for Adx
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more