pub struct SupertrendEngine { /* private fields */ }Expand description
Supertrend: a trailing band that flips with the close.
ATR is the plain mean of the last period true ranges (the first high - low), not a
Wilder average. Basic bands are (high + low) / 2 ± multiplier * ATR. A final band only moves
against the trend when the previous close crossed it: the upper band takes the new basic value
if that is lower or the previous close was above the old band, the lower band if it is higher or
the previous close was below. The trend starts up and flips when the close falls below the final
lower band (in an uptrend) or rises above the final upper band (in a downtrend).
value: the lower band in an uptrend, the upper band in a downtrend; extra["trend"]
(1/-1), extra["upper"], extra["lower"]. First output: with the period-th bar.
Indicator::reset clears the window and the bands.
Implementations§
Trait Implementations§
Source§impl Indicator for SupertrendEngine
impl Indicator for SupertrendEngine
fn name(&self) -> &str
fn warmup_period(&self) -> usize
fn reset(&mut self)
fn on_bar(&mut self, bar: &Bar) -> Option<IndicatorOutput>
fn alerts(&self) -> Vec<IndicatorAlert>
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.