pub struct KickingByLength { /* private fields */ }Expand description
Kicking-by-Length — the Kicking pattern with the signal
taken from the longer of the two marubozu rather than from the gap direction.
When the two shadowless candles differ in size, the bigger one is treated as
the dominant force.
marubozu = |close − open| >= 0.95 * (high − low)
setup: two opposite-coloured marubozu separated by a gap
black then white gapping UP, or white then black gapping DOWN
signal = colour of the LONGER marubozu (white -> +1.0, black -> −1.0)Output is +1.0 or −1.0 when the kicking setup is present and 0.0
otherwise. Note this can disagree with Kicking: a black
marubozu kicked up by a shorter white marubozu reports −1.0 here. The first
bar always returns 0.0 because the two-bar window is not yet filled. The
marubozu threshold follows 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, −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, Indicator, KickingByLength};
let mut indicator = KickingByLength::new();
indicator.update(Candle::new(12.0, 12.0, 10.0, 10.0, 1.0, 0).unwrap());
// White marubozu gaps up and is the longer body -> +1.
let out = indicator
.update(Candle::new(14.0, 20.0, 14.0, 20.0, 1.0, 1).unwrap());
assert_eq!(out, Some(1.0));Implementations§
Trait Implementations§
Source§impl Clone for KickingByLength
impl Clone for KickingByLength
Source§fn clone(&self) -> KickingByLength
fn clone(&self) -> KickingByLength
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 KickingByLength
impl Debug for KickingByLength
Source§impl Default for KickingByLength
impl Default for KickingByLength
Source§fn default() -> KickingByLength
fn default() -> KickingByLength
Source§impl Indicator for KickingByLength
impl Indicator for KickingByLength
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 KickingByLength
impl RefUnwindSafe for KickingByLength
impl Send for KickingByLength
impl Sync for KickingByLength
impl Unpin for KickingByLength
impl UnsafeUnpin for KickingByLength
impl UnwindSafe for KickingByLength
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