pub struct StdDevChannel { /* private fields */ }Expand description
Standard Deviation Channel — measures how many standard deviations the current close is from the rolling mean of closes.
z = (close - mean(close, period)) / stddev(close, period)Positive values mean the close is above the channel center; negative values below. The classic ±1 and ±2 levels act as dynamic support/resistance.
Returns SignalValue::Unavailable until period bars have been seen or
when standard deviation is zero (flat prices).
§Example
use fin_primitives::signals::indicators::StdDevChannel;
use fin_primitives::signals::Signal;
let s = StdDevChannel::new("sdc", 20).unwrap();
assert_eq!(s.period(), 20);Implementations§
Trait Implementations§
Source§impl Signal for StdDevChannel
impl Signal for StdDevChannel
Source§fn is_ready(&self) -> bool
fn is_ready(&self) -> bool
Returns
true if the signal has accumulated enough bars to produce a value.Source§fn period(&self) -> usize
fn period(&self) -> usize
Returns the number of bars required before the signal produces a value.
Source§fn reset(&mut self)
fn reset(&mut self)
Resets the signal to its initial state as if no bars had been seen. Read more
Source§fn update_bar(&mut self, bar: &OhlcvBar) -> Result<SignalValue, FinError>
fn update_bar(&mut self, bar: &OhlcvBar) -> Result<SignalValue, FinError>
Auto Trait Implementations§
impl Freeze for StdDevChannel
impl RefUnwindSafe for StdDevChannel
impl Send for StdDevChannel
impl Sync for StdDevChannel
impl Unpin for StdDevChannel
impl UnsafeUnpin for StdDevChannel
impl UnwindSafe for StdDevChannel
Blanket Implementations§
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