pub struct ParabolicSarEngine { /* private fields */ }Expand description
Parabolic SAR.
Starts long on the first bar with SAR = low, EP = high, AF = step, and publishes that
first SAR. On every following bar the next SAR is SAR + AF * (EP - SAR):
- Long: a low below it reverses to short — the SAR becomes the EP, the EP this bar’s low, and
AF = step. Otherwise a new high moves the EP and raisesAFbystepup tomax_step, and the SAR is held at or below the previous and the current low. - Short: symmetric, with highs.
The hold uses the previous bar’s extreme only (the current one is already excluded by the reversal check before it). The original rule holds the SAR beyond the extremes of the two previous bars, so after a sharp two-bar move this SAR can sit closer to price.
value: the SAR; extra["is_long"] (1/0) and extra["af"]. First output: with the first
bar. Indicator::reset returns to the long start.
Implementations§
Trait Implementations§
Source§impl Indicator for ParabolicSarEngine
impl Indicator for ParabolicSarEngine
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>
Validates a bar before forwarding it to
Indicator::on_bar.Auto Trait Implementations§
impl Freeze for ParabolicSarEngine
impl RefUnwindSafe for ParabolicSarEngine
impl Send for ParabolicSarEngine
impl Sync for ParabolicSarEngine
impl Unpin for ParabolicSarEngine
impl UnsafeUnpin for ParabolicSarEngine
impl UnwindSafe for ParabolicSarEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more