pub struct ThreeLineStrike { /* private fields */ }Expand description
Three Line Strike — a 4-bar pattern: three candles marching in one direction (a three-soldiers / three-crows advance) followed by a fourth candle of the opposite colour that opens beyond the third candle and closes back past the first candle’s open, “striking” through the whole run.
Bullish (+1.0):
bar1..bar3 green, each opening inside the prior body and closing higher
bar4 red & opens above bar3's close & closes below bar1's openBearish (−1.0): the mirror — three falling red candles struck by a
green bar4 that opens below bar3’s close and closes above bar1’s open.
Output is 0.0 otherwise. The first three bars always return 0.0 because
the four-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 bullish, −1.0 bearish, 0.0 no pattern — so it
drops straight into a machine-learning feature matrix where the bullish and
bearish variants occupy a single dimension.
§Example
use wickra_core::{Candle, Indicator, ThreeLineStrike};
let mut indicator = ThreeLineStrike::new();
indicator.update(Candle::new(10.0, 11.1, 9.9, 11.0, 1.0, 0).unwrap());
indicator.update(Candle::new(10.5, 12.1, 10.4, 12.0, 1.0, 1).unwrap());
indicator.update(Candle::new(11.5, 13.1, 11.4, 13.0, 1.0, 2).unwrap());
let out = indicator
.update(Candle::new(13.5, 13.6, 9.4, 9.5, 1.0, 3).unwrap());
assert_eq!(out, Some(1.0));Implementations§
Trait Implementations§
Source§impl Clone for ThreeLineStrike
impl Clone for ThreeLineStrike
Source§fn clone(&self) -> ThreeLineStrike
fn clone(&self) -> ThreeLineStrike
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 ThreeLineStrike
impl Debug for ThreeLineStrike
Source§impl Default for ThreeLineStrike
impl Default for ThreeLineStrike
Source§fn default() -> ThreeLineStrike
fn default() -> ThreeLineStrike
Source§impl Indicator for ThreeLineStrike
impl Indicator for ThreeLineStrike
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 ThreeLineStrike
impl RefUnwindSafe for ThreeLineStrike
impl Send for ThreeLineStrike
impl Sync for ThreeLineStrike
impl Unpin for ThreeLineStrike
impl UnsafeUnpin for ThreeLineStrike
impl UnwindSafe for ThreeLineStrike
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