pub struct BetterVolume { /* private fields */ }Expand description
Better Volume — Barry Taylor’s (emini-watch) classification of each volume
bar by its effort (volume) against its result (range) over a period-bar
lookback.
range = high − low
low volume : volume is a new low of the lookback -> 1
climax : volume · range is a new high of the lookback -> +3 up bar, −3 down bar
churn : volume / range is a new high of the lookback -> 2
both : climax and churn on the same bar -> 4
otherwise -> 0The rules are applied in that order and a later match overrides an earlier
one, as in Taylor’s original. “New high / low” means strictly beyond every one
of the previous period − 1 bars, so a run of identical bars stays neutral.
A zero-range bar has no defined volume per range and never counts as churn.
Reading the codes (Volume Spread Analysis): a climax is the most effort meeting the widest result — often the start or end of a move; churn is heavy volume going nowhere — professional absorption near turning points; and a low-volume bar shows the absence of interest that marks pullbacks and tests.
Input = Candle, Output = f64 (one of 0, 1, 2, ±3, 4),
warmup_period == period.
§Example
use wickra_core::{BetterVolume, Candle, Indicator};
let mut bv = BetterVolume::new(3).unwrap();
bv.update(Candle::new(100.0, 101.0, 99.0, 100.5, 1_000.0, 0).unwrap());
bv.update(Candle::new(100.5, 101.5, 99.5, 101.0, 1_000.0, 1).unwrap());
// A wide up bar with the most volume · range, but not the most volume per
// point of range: a climax up bar.
let out = bv.update(Candle::new(101.0, 105.0, 100.5, 104.5, 2_000.0, 2).unwrap());
assert_eq!(out, Some(3.0));Implementations§
Source§impl BetterVolume
impl BetterVolume
Trait Implementations§
Source§impl Clone for BetterVolume
impl Clone for BetterVolume
Source§impl Debug for BetterVolume
impl Debug for BetterVolume
Source§impl Indicator for BetterVolume
impl Indicator for BetterVolume
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 there is no value for this input. Read moreSource§fn reset(&mut self)
fn reset(&mut self)
Source§fn warmup_period(&self) -> usize
fn warmup_period(&self) -> usize
None output can be produced.Source§fn is_ready(&self) -> bool
fn is_ready(&self) -> bool
Source§fn name(&self) -> &'static str
fn name(&self) -> &'static str
Source§fn batch_nan_into(&mut self, inputs: &[Self::Input], out: &mut [f64])
fn batch_nan_into(&mut self, inputs: &[Self::Input], out: &mut [f64])
Source§fn batch_fast_into(&mut self, inputs: &[Self::Input], out: &mut [f64])
fn batch_fast_into(&mut self, inputs: &[Self::Input], out: &mut [f64])
batch_nan_into, but
an indicator with a vectorised kernel may reassociate its arithmetic to
run it in SIMD lanes. Each value then agrees with the exact batch to within
the tolerance the indicator documents (a few units in the last place), not
bit for bit; warmup positions, NaN placement and the output length are
identical. The kernels are deterministic: the same input produces the same
bits on every platform, with or without SIMD hardware. Read moreAuto Trait Implementations§
impl Freeze for BetterVolume
impl RefUnwindSafe for BetterVolume
impl Send for BetterVolume
impl Sync for BetterVolume
impl Unpin for BetterVolume
impl UnsafeUnpin for BetterVolume
impl UnwindSafe for BetterVolume
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