pub struct Hikkake { /* private fields */ }Expand description
Hikkake — a 3-bar trap. An inside bar (bar2 fully contained by bar1) sets up a breakout that immediately fails on bar3, trapping breakout traders and pointing the opposite way.
inside bar : bar2.high < bar1.high && bar2.low > bar1.low
bullish (+1.0): bar3 makes a LOWER high AND LOWER low than bar2
(a false downside break -> expect a move up)
bearish (−1.0): bar3 makes a HIGHER high AND HIGHER low than bar2
(a false upside break -> expect a move down)Output is +1.0 (bullish setup), −1.0 (bearish setup), or 0.0 otherwise.
The detector fires when the three-bar setup completes on bar3; it does not
separately flag the optional later confirmation bar. The first two bars always
return 0.0 because the 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 setups occupy a single dimension.
§Example
use wickra_core::{Candle, Hikkake, Indicator};
let mut indicator = Hikkake::new();
indicator.update(Candle::new(10.0, 15.0, 5.0, 12.0, 1.0, 0).unwrap());
indicator.update(Candle::new(11.0, 13.0, 8.0, 12.0, 1.0, 1).unwrap());
let out = indicator
.update(Candle::new(9.0, 12.0, 6.0, 7.0, 1.0, 2).unwrap());
assert_eq!(out, Some(1.0));Implementations§
Trait Implementations§
Source§impl Indicator for Hikkake
impl Indicator for Hikkake
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 Hikkake
impl RefUnwindSafe for Hikkake
impl Send for Hikkake
impl Sync for Hikkake
impl Unpin for Hikkake
impl UnsafeUnpin for Hikkake
impl UnwindSafe for Hikkake
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