pub struct WavePm { /* private fields */ }Expand description
Wave PM (Peak Momentum): a 0..100 statistic that rises when the current
length-bar momentum is large relative to its own recent energy — Cynthia
Kase’s gauge of how “peaked” the move is.
m = close_t - close_{t-length} (length-bar momentum)
energy = EMA(m^2, length) (mean squared momentum)
raw = 1 - exp( -m^2 / (2 * energy) ) (0 if energy == 0)
WavePM = 100 * EMA(raw, smoothing)The momentum m is normalised by its recent variance (energy): a move that
merely matches its typical energy sits at the baseline
100·(1 − e^{−1/2}) ≈ 39.35, while a momentum spike that exceeds recent
energy drives the reading toward 100. A flat market (m = 0) reads 0.
High readings mark a peaking, possibly exhausted move rather than a fresh one.
Kase’s published WavePM is platform-specific; this is Wickra’s faithful
reconstruction of its variance-normalised peak-momentum form. The exact
constants differ from any single vendor implementation, but the shape — flat
at zero, a fixed baseline on a steady trend, and saturation on an
acceleration — matches the indicator’s intent.
Reference: Cynthia Kase, Trading with the Odds, 1996 (Wickra reconstruction).
§Example
use wickra_core::{Indicator, WavePm};
let mut indicator = WavePm::new(10, 3).unwrap();
let mut last = None;
for i in 0..60 {
last = indicator.update(100.0 + f64::from(i));
}
assert!(last.is_some());Implementations§
Trait Implementations§
Source§impl Indicator for WavePm
impl Indicator for WavePm
Source§fn update(&mut self, close: f64) -> Option<f64>
fn update(&mut self, close: f64) -> 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 WavePm
impl RefUnwindSafe for WavePm
impl Send for WavePm
impl Sync for WavePm
impl Unpin for WavePm
impl UnsafeUnpin for WavePm
impl UnwindSafe for WavePm
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