pub struct Vortex { /* private fields */ }Expand description
Vortex Indicator — computes VI+ (upward movement) as the primary scalar output.
VM+[i] = |high[i] - low[i-1]|
VM-[i] = |low[i] - high[i-1]|
TR[i] = max(high[i], prev_close) - min(low[i], prev_close)
VI+ = sum(VM+, n) / sum(TR, n)
VI- = sum(VM-, n) / sum(TR, n)Signal::update() returns VI+ as the primary scalar. Access VI- via Vortex::vi_minus.
Returns SignalValue::Unavailable until period bars have been seen.
§Example
use fin_primitives::signals::indicators::Vortex;
use fin_primitives::signals::Signal;
let vortex = Vortex::new("vx", 14).unwrap();
assert_eq!(vortex.period(), 14);Implementations§
Trait Implementations§
Source§impl Signal for Vortex
impl Signal for Vortex
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 Vortex
impl RefUnwindSafe for Vortex
impl Send for Vortex
impl Sync for Vortex
impl Unpin for Vortex
impl UnsafeUnpin for Vortex
impl UnwindSafe for Vortex
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