pub struct GravestoneDoji { /* private fields */ }Expand description
Gravestone Doji — a single-bar bearish reversal. Open, close, and low sit at the bottom of the bar while a long upper shadow shows price was pushed up hard and then sold all the way back to the open — sellers rejecting the highs.
range = high − low
doji = |close − open| <= 0.1 * range
no lower wick = min(open, close) − low <= 0.1 * range
long upper = high − max(open, close) >= 0.5 * rangeOutput is −1.0 when the gravestone prints and 0.0 otherwise. Gravestone
Doji is a single-direction (bearish-only) shape, so it never emits +1.0.
Body and shadow thresholds follow the geometric house style (fixed fractions
of the bar range) 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 bearish, 0.0 no pattern — so it drops straight into
a machine-learning feature matrix as a single dimension.
§Example
use wickra_core::{Candle, GravestoneDoji, Indicator};
let mut indicator = GravestoneDoji::new();
// Body at the bottom, long upper shadow.
let candle = Candle::new(10.0, 14.0, 9.95, 10.0, 1.0, 0).unwrap();
assert_eq!(indicator.update(candle), Some(-1.0));Implementations§
Trait Implementations§
Source§impl Clone for GravestoneDoji
impl Clone for GravestoneDoji
Source§fn clone(&self) -> GravestoneDoji
fn clone(&self) -> GravestoneDoji
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 GravestoneDoji
impl Debug for GravestoneDoji
Source§impl Default for GravestoneDoji
impl Default for GravestoneDoji
Source§fn default() -> GravestoneDoji
fn default() -> GravestoneDoji
Source§impl Indicator for GravestoneDoji
impl Indicator for GravestoneDoji
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 GravestoneDoji
impl RefUnwindSafe for GravestoneDoji
impl Send for GravestoneDoji
impl Sync for GravestoneDoji
impl Unpin for GravestoneDoji
impl UnsafeUnpin for GravestoneDoji
impl UnwindSafe for GravestoneDoji
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