pub struct BbTrend { /* private fields */ }Expand description
BBTrend: how far a short Bollinger set has moved out of a long one.
Two band sets over the same prices, one short and one long, with the same multiplier and the same variance convention. The published value compares how far each edge of the short set sits from the matching edge of the long set:
BBTrend = 100 * (|lower_short - lower_long| - |upper_short - upper_long|) / basis_shortPositive means the short set has pushed further out at the top than at the bottom — the recent window is trending up relative to the longer one — and negative the reverse. Around zero the two sets sit concentrically, which is what a range looks like.
Both sets come from the same BollingerBands engine this crate already has, so there is one
band calculation, not a second one written for this indicator. The variance convention applies
to both sets: comparing a population-based set against a sample-based one would measure the
convention rather than the market.
Unit: percent of the short basis. Division by a zero basis cannot arise from valid bars, whose
prices are positive; should it, the value is 0.
Per-bar outputs:
value: the BBTrend line.extra["upper_gap"]/extra["lower_gap"]: the two absolute edge distances it is built from, so a reader can see which side moved.
First output: with the long_len-th bar, when both sets exist. Indicator::reset clears
both.
Implementations§
Trait Implementations§
Source§impl Indicator for BbTrend
impl Indicator for BbTrend
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.