pub struct DumplingTop { /* private fields */ }Expand description
Dumpling Top — the bearish mirror of the FryPanBottom:
a gently rounded top (dome) across the window, confirmed by a close back
below where it started.
over the last `period` closes:
the maximum close sits in the middle third of the window (the "dome")
the latest close is below the first close (the breakdown)
signal = −1 when both hold, else 0The dumpling top is a distribution pattern: price rounds over at the top as
buying fades, then rolls down through the level it rose from. Detection requires
a central high (a symmetric dome, not a one-sided spike) and a close below the
window’s opening level. The output is −1.0 (pattern) or 0.0.
The first value lands after period inputs; each update scans the window in
O(period).
§Example
use wickra_core::{Candle, Indicator, DumplingTop};
let mut indicator = DumplingTop::new(9).unwrap();
let closes = [100.0, 102.0, 104.0, 105.0, 104.0, 102.0, 99.0, 97.0, 95.0];
let mut last = None;
for &cl in &closes {
let c = Candle::new(cl, cl + 0.5, cl - 0.5, cl, 1_000.0, 0).unwrap();
last = indicator.update(c);
}
assert_eq!(last, Some(-1.0));Implementations§
Source§impl DumplingTop
impl DumplingTop
Trait Implementations§
Source§impl Clone for DumplingTop
impl Clone for DumplingTop
Source§fn clone(&self) -> DumplingTop
fn clone(&self) -> DumplingTop
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DumplingTop
impl Debug for DumplingTop
Source§impl Indicator for DumplingTop
impl Indicator for DumplingTop
Source§type Input = Candle
type Input = Candle
Type of one input data point (typically
f64 for a price, or Candle / Tick).Source§fn update(&mut self, candle: Candle) -> Option<f64>
fn update(&mut self, candle: Candle) -> Option<f64>
Feed one new data point into the indicator and return the freshly computed
output, or
None if the indicator is still warming up.Source§fn reset(&mut self)
fn reset(&mut self)
Reset all internal state, leaving the indicator equivalent to a freshly
constructed instance with the same parameters.
Source§fn warmup_period(&self) -> usize
fn warmup_period(&self) -> usize
Number of inputs required before the first non-
None output can be produced.Auto Trait Implementations§
impl Freeze for DumplingTop
impl RefUnwindSafe for DumplingTop
impl Send for DumplingTop
impl Sync for DumplingTop
impl Unpin for DumplingTop
impl UnsafeUnpin for DumplingTop
impl UnwindSafe for DumplingTop
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>>
Run the indicator over a slice of inputs in order, returning one output (or
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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