pub struct HeikinAshi { /* private fields */ }Expand description
Streaming Heikin-Ashi transformation.
From the second candle on:
ha_close = (open + high + low + close) / 4
ha_open = (previous ha_open + previous ha_close) / 2
ha_high = max(high, ha_open, ha_close)
ha_low = min(low, ha_open, ha_close)The first candle has no predecessor to average, so its ha_open is (open + close) / 2 of
that bar. That is a decision, not a derivation: other implementations seed with (O+H+L+C)/4
instead and produce a different opening candle, after which both converge.
The recursion is causal — a candle is final when its bar is — and it carries state, so a
series switch must go through HeikinAshi::reset rather than continuing across the
boundary; see SeriesIdentity for what makes two series different.
Implementations§
Trait Implementations§
Source§impl Clone for HeikinAshi
impl Clone for HeikinAshi
Source§fn clone(&self) -> HeikinAshi
fn clone(&self) -> HeikinAshi
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HeikinAshi
impl Debug for HeikinAshi
Source§impl Default for HeikinAshi
impl Default for HeikinAshi
Source§fn default() -> HeikinAshi
fn default() -> HeikinAshi
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for HeikinAshi
impl RefUnwindSafe for HeikinAshi
impl Send for HeikinAshi
impl Sync for HeikinAshi
impl Unpin for HeikinAshi
impl UnsafeUnpin for HeikinAshi
impl UnwindSafe for HeikinAshi
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