pub struct IdenticalThreeCrows { /* private fields */ }Expand description
Identical Three Crows — a 3-bar bearish reversal: three consecutive red candles with steadily lower closes where each candle opens at (or very near) the prior candle’s close, so the bodies stack in an identical staircase.
tol_n = tolerance * max(|open|, |prev.close|)
all three red (close < open)
declining closes (bar2.close < bar1.close, bar3.close < bar2.close)
bar2 opens at bar1's close (|bar2.open − bar1.close| <= tol_2)
bar3 opens at bar2's close (|bar3.open − bar2.close| <= tol_3)Output is −1.0 when the pattern completes and 0.0 otherwise. Identical
Three Crows is a single-direction (bearish-only) pattern, so it never emits
+1.0. The first two bars always return 0.0 because the three-bar window
is not yet filled. tolerance defaults to 0.001 (10 bps relative) and must
lie in [0, 1). Pattern-shape check only — no trend filter is applied;
combine with a trend indicator for actionable signals.
§Signed ±1 encoding
This detector emits the uniform candlestick sign convention shared across the
pattern family — −1.0 bearish, 0.0 no pattern — so it drops straight into
a machine-learning feature matrix as a single dimension.
§Example
use wickra_core::{Candle, IdenticalThreeCrows, Indicator};
let mut indicator = IdenticalThreeCrows::new();
indicator.update(Candle::new(13.0, 13.1, 11.9, 12.0, 1.0, 0).unwrap());
indicator.update(Candle::new(12.0, 12.1, 10.9, 11.0, 1.0, 1).unwrap());
let out = indicator
.update(Candle::new(11.0, 11.1, 9.9, 10.0, 1.0, 2).unwrap());
assert_eq!(out, Some(-1.0));Implementations§
Source§impl IdenticalThreeCrows
impl IdenticalThreeCrows
Sourcepub fn with_tolerance(tolerance: f64) -> Result<Self>
pub fn with_tolerance(tolerance: f64) -> Result<Self>
Construct a detector with a custom relative tolerance.
tolerance must lie in [0, 1).
Trait Implementations§
Source§impl Clone for IdenticalThreeCrows
impl Clone for IdenticalThreeCrows
Source§fn clone(&self) -> IdenticalThreeCrows
fn clone(&self) -> IdenticalThreeCrows
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 IdenticalThreeCrows
impl Debug for IdenticalThreeCrows
Source§impl Default for IdenticalThreeCrows
impl Default for IdenticalThreeCrows
Source§impl Indicator for IdenticalThreeCrows
impl Indicator for IdenticalThreeCrows
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 IdenticalThreeCrows
impl RefUnwindSafe for IdenticalThreeCrows
impl Send for IdenticalThreeCrows
impl Sync for IdenticalThreeCrows
impl Unpin for IdenticalThreeCrows
impl UnsafeUnpin for IdenticalThreeCrows
impl UnwindSafe for IdenticalThreeCrows
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