pub struct ThreeBarPattern { /* private fields */ }Expand description
Three Bar Pattern — detects Three White Soldiers (bullish) and Three Black Crows (bearish) candlestick patterns.
Three White Soldiers (output +1):
- Three consecutive bullish bars (
close > open) - Each bar closes higher than the previous
- Each bar opens within the prior bar’s body
Three Black Crows (output -1):
- Three consecutive bearish bars (
close < open) - Each bar closes lower than the previous
- Each bar opens within the prior bar’s body
Outputs 0 if no pattern is detected.
Returns SignalValue::Unavailable until 3 bars have been seen.
§Example
use fin_primitives::signals::indicators::ThreeBarPattern;
use fin_primitives::signals::Signal;
let tbp = ThreeBarPattern::new("tbp").unwrap();
assert_eq!(tbp.period(), 3);Implementations§
Trait Implementations§
Source§impl Signal for ThreeBarPattern
impl Signal for ThreeBarPattern
Source§fn period(&self) -> usize
fn period(&self) -> usize
Returns the number of bars required before the signal produces a value.
Source§fn is_ready(&self) -> bool
fn is_ready(&self) -> bool
Returns
true if the signal has accumulated enough bars to produce a value.Source§fn reset(&mut self)
fn reset(&mut self)
Resets the signal to its initial state as if no bars had been seen. Read more
Source§fn update_bar(&mut self, bar: &OhlcvBar) -> Result<SignalValue, FinError>
fn update_bar(&mut self, bar: &OhlcvBar) -> Result<SignalValue, FinError>
Auto Trait Implementations§
impl Freeze for ThreeBarPattern
impl RefUnwindSafe for ThreeBarPattern
impl Send for ThreeBarPattern
impl Sync for ThreeBarPattern
impl Unpin for ThreeBarPattern
impl UnsafeUnpin for ThreeBarPattern
impl UnwindSafe for ThreeBarPattern
Blanket Implementations§
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
Mutably borrows from an owned value. Read more