pub struct UpsideGapTwoCrows { /* private fields */ }Expand description
Upside Gap Two Crows — a 3-bar bearish reversal that appears after an advance. Two black candles gap up above a long white candle; the second black candle engulfs the first crow yet still closes above the white body, leaving the upside gap open.
bar1 green (long white)
bar2 red & its body gaps up above bar1's body (bar2.close > bar1.close)
bar3 red & opens above bar2's open (bar3.open > bar2.open)
& closes below bar2's close (bar3.close < bar2.close)
& closes above bar1's close (bar3.close > bar1.close)Output is −1.0 when the pattern completes and 0.0 otherwise. Upside Gap
Two 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. 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, Indicator, UpsideGapTwoCrows};
let mut indicator = UpsideGapTwoCrows::new();
indicator.update(Candle::new(10.0, 12.2, 9.9, 12.0, 1.0, 0).unwrap());
indicator.update(Candle::new(14.0, 14.2, 12.9, 13.0, 1.0, 1).unwrap());
let out = indicator
.update(Candle::new(15.0, 15.2, 12.4, 12.5, 1.0, 2).unwrap());
assert_eq!(out, Some(-1.0));Implementations§
Trait Implementations§
Source§impl Clone for UpsideGapTwoCrows
impl Clone for UpsideGapTwoCrows
Source§fn clone(&self) -> UpsideGapTwoCrows
fn clone(&self) -> UpsideGapTwoCrows
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 UpsideGapTwoCrows
impl Debug for UpsideGapTwoCrows
Source§impl Default for UpsideGapTwoCrows
impl Default for UpsideGapTwoCrows
Source§fn default() -> UpsideGapTwoCrows
fn default() -> UpsideGapTwoCrows
Source§impl Indicator for UpsideGapTwoCrows
impl Indicator for UpsideGapTwoCrows
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 UpsideGapTwoCrows
impl RefUnwindSafe for UpsideGapTwoCrows
impl Send for UpsideGapTwoCrows
impl Sync for UpsideGapTwoCrows
impl Unpin for UpsideGapTwoCrows
impl UnsafeUnpin for UpsideGapTwoCrows
impl UnwindSafe for UpsideGapTwoCrows
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