pub struct RelativeVolatilityIndex { /* private fields */ }Expand description
Relative Volatility Index: the Relative Strength Index construction applied to volatility instead of to price change.
For each bar the standard deviation of the last stdev_len prices is computed. That figure is
then filed under “up” or “down” depending on which way the price moved, and the two are
Wilder-smoothed over smooth_len:
up_t = stdev_t if price rose, else 0
down_t = stdev_t if price fell, else 0
RVI = 100 * rma(up) / (rma(up) + rma(down))So it answers “is the recent movement concentrated on the up side or the down side”, where movement means dispersion, not distance. A market that falls steadily with little scatter can therefore read differently from an RSI on the same bars.
This is not the Relative Vigor Index, which this crate registers as rvi and which
compares the close-open span to the high-low span. Same three letters, unrelated measurement;
hence the separate name.
No claim of numerical agreement with any other implementation is made: the published descriptions of this indicator leave the direction rule, the smoothing and the seed open, and what is implemented here is the contract stated above.
Unit: 0..=100. A bar where the price did not move contributes to neither side. A window in
which nothing moved at all leaves both averages at zero; the documented convention there is
50, the same neutral reading this crate’s RSI uses.
First output: once both the deviation window and the Wilder averages are ready, i.e. with bar
stdev_len + smooth_len - 1. Indicator::reset clears the window and both averages.
Implementations§
Source§impl RelativeVolatilityIndex
impl RelativeVolatilityIndex
pub fn new( stdev_len: usize, smooth_len: usize, variant: RelativeVolatilityVariant, ) -> Self
pub fn with_defaults() -> Self
pub fn variant(&self) -> RelativeVolatilityVariant
Trait Implementations§
Source§impl Clone for RelativeVolatilityIndex
impl Clone for RelativeVolatilityIndex
Source§fn clone(&self) -> RelativeVolatilityIndex
fn clone(&self) -> RelativeVolatilityIndex
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 RelativeVolatilityIndex
impl Debug for RelativeVolatilityIndex
Source§impl Indicator for RelativeVolatilityIndex
impl Indicator for RelativeVolatilityIndex
fn name(&self) -> &str
fn warmup_period(&self) -> usize
fn on_bar(&mut self, bar: &Bar) -> Option<IndicatorOutput>
fn reset(&mut self)
Source§fn on_checked_bar(
&mut self,
bar: &Bar,
) -> Result<Option<IndicatorOutput>, BarValidationError>
fn on_checked_bar( &mut self, bar: &Bar, ) -> Result<Option<IndicatorOutput>, BarValidationError>
Indicator::on_bar.