pub struct RelativeVolumeAtTime { /* private fields */ }Expand description
Relative Volume at Time: this bar’s volume against the volume at the same time of day on previous days.
The rolling super::volume_indicators::RvolEngine answers a different question — how this
bar compares to the recent ones, whatever hour they fell in. At 09:31 that comparison is
dominated by the opening bar and says little. Here the comparison runs down the same column of
the clock instead: 09:31 today against 09:31 on each of the previous days days.
Two ratios come out of it, and they are not interchangeable:
value: regular — this bar’s volume divided by the average volume in the same slot on previous days.extra["cumulative"]: cumulative — the volume accumulated since the start of today divided by the average of what had accumulated by the same slot on previous days. This is the one that answers “is today busy so far”, and it is far less jumpy than the regular one.
The day starts at day_start_offset seconds after midnight UTC, so a market whose session
does not align with UTC midnight can be placed correctly. A slot is the number of seconds into
that day, which makes bars of any spacing line up as long as they arrive at consistent times.
Only days strictly before today count as comparison. Today’s own bars never enter their own reference, so no value depends on data that did not exist when the bar closed.
How many comparison days actually contributed is published rather than assumed:
extra["samples"]: number of previous days that had a bar in this slot.extra["complete"]:1.0when that number equalsdays,0.0otherwise.
A missing slot lowers samples; it is never filled in from a neighbouring slot or an earlier
day. A shortened trading day therefore shows up as an incomplete comparison instead of a
quietly wrong ratio.
Unit: a ratio, where 1.0 means “as much as usual at this time”. Zero average volume in the
comparison slots produces no output — a ratio against nothing has no meaning.
First output: the first bar whose slot has at least one previous day to compare against —
one day of bars. How many bars that is depends on the timeframe, which this indicator cannot
know from a timestamp alone, so bar_seconds states it. That parameter is declarative only:
it makes Indicator::warmup_period an honest number of bars and has no influence on the
calculation, which always derives slots from timestamps. A wrong value misstates the declared
warmup, never a ratio.
Memory is bounded by pruning slots untouched for more than days days.
Implementations§
Trait Implementations§
Source§impl Clone for RelativeVolumeAtTime
impl Clone for RelativeVolumeAtTime
Source§fn clone(&self) -> RelativeVolumeAtTime
fn clone(&self) -> RelativeVolumeAtTime
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 RelativeVolumeAtTime
impl Debug for RelativeVolumeAtTime
Source§impl Indicator for RelativeVolumeAtTime
impl Indicator for RelativeVolumeAtTime
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.