pub struct RciEngine { /* private fields */ }Expand description
Rank Correlation Index: how closely the order of the last len prices follows the order of
time.
Prices in the window are ranked, time is ranked by position, and the two rank series are correlated; the result is scaled by 100. A window whose prices rise monotonically gives +100, one that falls monotonically -100, and a shuffled one something in between.
Ties get the average of the ranks they share. Two equal prices are not one before the
other, and pretending otherwise would invent an ordering the market did not produce. The
correlation is then computed over the rank series directly rather than through the
1 - 6*sum(d^2)/(n^3-n) shortcut, which is only valid when no rank is shared.
Unit: an index in -100..=100, not a percentage of anything.
A window without price variance — every price equal — has no ordering at all. There is no
correlation to compute, and the documented convention is 0: no direction, rather than a
trend strength conjured from nothing.
First output: with the len-th bar. len must be at least 2, since a single price has no
order. A window that holds a non-finite price produces no output at all — there is no ordering
to compute. Indicator::reset clears the window.
Implementations§
Trait Implementations§
Source§impl Indicator for RciEngine
impl Indicator for RciEngine
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.