pub struct BullishPercentIndex { /* private fields */ }Expand description
Bullish Percent Index (BPI) — the percentage of symbols in a universe that are currently on a point-and-figure buy signal.
On each CrossSection tick the value is 100 * on_buy_signal_count / universe size, read from the per-symbol on_buy_signal flag (the caller
evaluates each symbol’s point-and-figure chart when it builds the tick). It is
a bounded 0..=100 gauge of how many issues are in a confirmed uptrend.
Readings above 70 are considered overbought (broad strength, but a crowded
market) and below 30 oversold; reversals from those zones are classic BPI
buy/sell triggers.
Input = CrossSection, Output = f64 (a percentage in 0..=100),
warmup_period == 1. The universe is non-empty by construction, so the share
is always defined.
§Example
use wickra_core::{BullishPercentIndex, CrossSection, Indicator, Member};
let mut bpi = BullishPercentIndex::new();
// 2 of 4 symbols on a buy signal -> 50%.
let tick = CrossSection::new(
vec![
Member::with_signals(1.0, 10.0, false, false, false, true),
Member::with_signals(1.0, 10.0, false, false, false, true),
Member::with_signals(-1.0, 10.0, false, false, false, false),
Member::with_signals(-1.0, 10.0, false, false, false, false),
],
0,
)
.unwrap();
assert_eq!(bpi.update(tick), Some(50.0));Implementations§
Source§impl BullishPercentIndex
impl BullishPercentIndex
Sourcepub const fn new() -> BullishPercentIndex
pub const fn new() -> BullishPercentIndex
Construct a new Bullish Percent Index indicator.
Trait Implementations§
Source§impl Clone for BullishPercentIndex
impl Clone for BullishPercentIndex
Source§fn clone(&self) -> BullishPercentIndex
fn clone(&self) -> BullishPercentIndex
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 BullishPercentIndex
impl Debug for BullishPercentIndex
Source§impl Default for BullishPercentIndex
impl Default for BullishPercentIndex
Source§fn default() -> BullishPercentIndex
fn default() -> BullishPercentIndex
Source§impl Indicator for BullishPercentIndex
impl Indicator for BullishPercentIndex
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 BullishPercentIndex
impl RefUnwindSafe for BullishPercentIndex
impl Send for BullishPercentIndex
impl Sync for BullishPercentIndex
impl Unpin for BullishPercentIndex
impl UnsafeUnpin for BullishPercentIndex
impl UnwindSafe for BullishPercentIndex
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