pub struct IntradayIntensity { /* private fields */ }Expand description
Intraday Intensity — David Bostian’s per-bar measure that weights each bar’s volume by where the close lands inside the bar’s range:
II_t = volume * (2*close − high − low) / (high − low) (0 if high == low)The fraction (2*close − high − low) / (high − low) is +1 when the bar
closes on its high, −1 when it closes on its low, and 0 at the midpoint,
so II_t is the volume pushed toward the extremes on that single bar —
Bostian’s proxy for per-bar accumulation (positive) or distribution
(negative).
This emits the raw per-bar intensity, which is distinct from the two
derived forms Wickra ships separately: the cumulative running total is
the Accumulation/Distribution Line (Adl), and the
volume-normalized windowed form (“Intraday Intensity %”) is mathematically
the Chaikin Money Flow (Cmf). A doji whose high == low
contributes nothing. Each update is O(1) and the first bar already emits a
value.
§Example
use wickra_core::{Candle, Indicator, IntradayIntensity};
let mut indicator = IntradayIntensity::new();
let mut last = None;
for i in 0..20 {
let base = 100.0 + f64::from(i);
let c = Candle::new(base, base + 1.0, base - 1.0, base + 0.9, 1_000.0, 0).unwrap();
last = indicator.update(c);
}
assert!(last.is_some());Implementations§
Trait Implementations§
Source§impl Clone for IntradayIntensity
impl Clone for IntradayIntensity
Source§fn clone(&self) -> IntradayIntensity
fn clone(&self) -> IntradayIntensity
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for IntradayIntensity
impl Debug for IntradayIntensity
Source§impl Default for IntradayIntensity
impl Default for IntradayIntensity
Source§fn default() -> IntradayIntensity
fn default() -> IntradayIntensity
Source§impl Indicator for IntradayIntensity
impl Indicator for IntradayIntensity
Source§type Input = Candle
type Input = Candle
f64 for a price, or Candle / Tick).Source§fn update(&mut self, candle: Candle) -> Option<f64>
fn update(&mut self, candle: Candle) -> Option<f64>
None if the indicator is still warming up.Source§fn reset(&mut self)
fn reset(&mut self)
Source§fn warmup_period(&self) -> usize
fn warmup_period(&self) -> usize
None output can be produced.Auto Trait Implementations§
impl Freeze for IntradayIntensity
impl RefUnwindSafe for IntradayIntensity
impl Send for IntradayIntensity
impl Sync for IntradayIntensity
impl Unpin for IntradayIntensity
impl UnsafeUnpin for IntradayIntensity
impl UnwindSafe for IntradayIntensity
Blanket Implementations§
Source§impl<T> BatchExt for Twhere
T: Indicator,
impl<T> BatchExt for Twhere
T: Indicator,
Source§fn batch(&mut self, inputs: &[Self::Input]) -> Vec<Option<Self::Output>>
fn batch(&mut self, inputs: &[Self::Input]) -> Vec<Option<Self::Output>>
None during warmup) per input.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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more