pub struct DojiStar { /* private fields */ }Expand description
Doji Star — a 2-bar reversal warning. A long trending body is followed by a doji whose tiny body gaps away in the direction of the trend, the indecision hinting the move is about to turn.
long body = |close − open| >= 0.5 * (high − low) (bar1)
doji = |close − open| <= 0.1 * (high − low) (bar2)
bullish (+1.0): bar1 black, doji body gaps DOWN below it (max(o2,c2) < close1)
bearish (−1.0): bar1 white, doji body gaps UP above it (min(o2,c2) > close1)Output is +1.0 (bullish star, after a black bar) or −1.0 (bearish star,
after a white bar) when the pattern completes, and 0.0 otherwise. The first
bar always returns 0.0 because the two-bar window is not yet filled. Doji
thresholds follow the geometric house style (fixed half-range body for the
long bar, tenth-range body for the doji) rather than TA-Lib’s rolling
averages. 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, DojiStar, Indicator};
let mut indicator = DojiStar::new();
// Long black bar, then a doji gapping down -> bullish star.
indicator.update(Candle::new(20.0, 20.2, 14.8, 15.0, 1.0, 0).unwrap());
let out = indicator
.update(Candle::new(13.0, 13.1, 12.9, 13.0, 1.0, 1).unwrap());
assert_eq!(out, Some(1.0));Implementations§
Trait Implementations§
Source§impl Indicator for DojiStar
impl Indicator for DojiStar
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 DojiStar
impl RefUnwindSafe for DojiStar
impl Send for DojiStar
impl Sync for DojiStar
impl Unpin for DojiStar
impl UnsafeUnpin for DojiStar
impl UnwindSafe for DojiStar
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