pub struct IntradayIntensity { /* private fields */ }Expand description
Intraday Intensity Index — David Bostian’s cumulative line 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)
III_t = III_{t−1} + II_tThe 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.
Scaling it by volume and accumulating produces a running measure of how
aggressively the close is being pushed toward the extremes — Bostian’s proxy
for institutional accumulation (rising line) or distribution (falling line).
This is the cumulative Intraday Intensity (the original index), not the
normalized “Intraday Intensity %” — the latter divides a windowed sum of II
by a windowed sum of volume and is mathematically identical to
Cmf, so it is not duplicated here. The level of this line is
arbitrary; only its slope and divergences against price matter. 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