pub struct NormalizedVolume { /* private fields */ }Expand description
Normalized Volume — divides the current bar’s volume by the SMA of volume
over the last period bars.
A value of 1.0 means volume equals its average. Values above 1.0 indicate
above-average volume; values below 1.0 indicate below-average volume.
Returns SignalValue::Unavailable until period bars have been seen, or when the
average volume is zero (e.g. all bars have zero volume).
§Example
use fin_primitives::signals::indicators::NormalizedVolume;
use fin_primitives::signals::Signal;
let nv = NormalizedVolume::new("nvol_20", 20).unwrap();
assert_eq!(nv.period(), 20);Implementations§
Trait Implementations§
Source§impl Signal for NormalizedVolume
impl Signal for NormalizedVolume
Source§fn period(&self) -> usize
fn period(&self) -> usize
Returns the number of bars required before the signal produces a value.
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 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 NormalizedVolume
impl RefUnwindSafe for NormalizedVolume
impl Send for NormalizedVolume
impl Sync for NormalizedVolume
impl Unpin for NormalizedVolume
impl UnsafeUnpin for NormalizedVolume
impl UnwindSafe for NormalizedVolume
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