pub struct MorningDojiStar { /* private fields */ }Expand description
Morning Doji Star — a 3-bar bullish bottom reversal. A long black bar extends the decline, a doji gaps down below it (the star of indecision), then a white bar gaps back up and closes deep into the first body, confirming the turn.
long body = |close − open| >= 0.5 * (high − low)
doji = |close − open| <= 0.1 * (high − low)
bar1 black & long
bar2 doji, body gaps DOWN below bar1 body (max(o2,c2) < close1)
bar3 white, body gaps UP above the doji (min(o3,c3) > max(o2,c2))
bar3 closes deep into bar1 body (close3 > close1 + penetration·body1)Output is +1.0 when the pattern completes and 0.0 otherwise. Morning Doji
Star is a single-direction (bullish-only) reversal, so it never emits −1.0.
The first two bars always return 0.0 because the three-bar window is not yet
filled. penetration is how far into the first body the third bar must close;
it defaults to 0.3 (TA-Lib’s CDLMORNINGDOJISTAR default) and must lie in
[0, 1). Body and doji thresholds follow the geometric house style 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, 0.0 no pattern — so it drops straight into
a machine-learning feature matrix as a single dimension.
§Example
use wickra_core::{Candle, Indicator, MorningDojiStar};
let mut indicator = MorningDojiStar::new();
indicator.update(Candle::new(15.0, 15.1, 9.9, 10.0, 1.0, 0).unwrap());
indicator.update(Candle::new(8.0, 8.1, 7.9, 8.0, 1.0, 1).unwrap());
let out = indicator
.update(Candle::new(9.0, 13.1, 8.9, 13.0, 1.0, 2).unwrap());
assert_eq!(out, Some(1.0));Implementations§
Source§impl MorningDojiStar
impl MorningDojiStar
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Construct a Morning Doji Star detector with the default 0.3 penetration.
Sourcepub fn with_penetration(penetration: f64) -> Result<Self>
pub fn with_penetration(penetration: f64) -> Result<Self>
Construct a Morning Doji Star detector with a custom penetration fraction.
penetration must lie in [0, 1).
Sourcepub fn penetration(&self) -> f64
pub fn penetration(&self) -> f64
Configured penetration fraction.
Trait Implementations§
Source§impl Clone for MorningDojiStar
impl Clone for MorningDojiStar
Source§fn clone(&self) -> MorningDojiStar
fn clone(&self) -> MorningDojiStar
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 MorningDojiStar
impl Debug for MorningDojiStar
Source§impl Default for MorningDojiStar
impl Default for MorningDojiStar
Source§impl Indicator for MorningDojiStar
impl Indicator for MorningDojiStar
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 MorningDojiStar
impl RefUnwindSafe for MorningDojiStar
impl Send for MorningDojiStar
impl Sync for MorningDojiStar
impl Unpin for MorningDojiStar
impl UnsafeUnpin for MorningDojiStar
impl UnwindSafe for MorningDojiStar
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