pub struct BreadthThrust { /* private fields */ }Expand description
Breadth Thrust (Zweig) — a simple moving average of the advancing-issues
share, advancers / (advancers + decliners).
Martin Zweig’s breadth thrust smooths the fraction of participating issues that are advancing over a short window (the classic period is 10). A “thrust” fires when this average climbs from below ~0.40 (oversold, washed-out breadth) to above ~0.615 within about ten sessions — historically a rare, reliable signal that a powerful new advance has begun with broad participation.
Each tick’s share floors the participating count to one, so a tick with no
advancing or declining issues contributes a defined 0.0 instead of dividing
by zero. The reading is None until period ticks have been seen.
Input = CrossSection, Output = f64 (a share in 0..=1),
warmup_period == period.
§Example
use wickra_core::{BreadthThrust, CrossSection, Indicator, Member};
let mut bt = BreadthThrust::new(2).unwrap();
let up = CrossSection::new(vec![Member::new(1.0, 1.0, false, false)], 0).unwrap();
assert_eq!(bt.update(up.clone()), None); // warming up
assert_eq!(bt.update(up), Some(1.0)); // both ticks 100% advancingImplementations§
Trait Implementations§
Source§impl Clone for BreadthThrust
impl Clone for BreadthThrust
Source§fn clone(&self) -> BreadthThrust
fn clone(&self) -> BreadthThrust
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 BreadthThrust
impl Debug for BreadthThrust
Source§impl Indicator for BreadthThrust
impl Indicator for BreadthThrust
Source§type Input = CrossSection
type Input = CrossSection
f64 for a price, or Candle / Tick).Source§fn update(&mut self, section: CrossSection) -> Option<f64>
fn update(&mut self, section: CrossSection) -> 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 BreadthThrust
impl RefUnwindSafe for BreadthThrust
impl Send for BreadthThrust
impl Sync for BreadthThrust
impl Unpin for BreadthThrust
impl UnsafeUnpin for BreadthThrust
impl UnwindSafe for BreadthThrust
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