pub trait IndicatorRefExt: IndicatorRef + Sized {
// Provided methods
fn above(self, threshold: f64) -> Above<Self> { ... }
fn above_ref<R: IndicatorRef>(self, other: R) -> AboveRef<Self, R> { ... }
fn below(self, threshold: f64) -> Below<Self> { ... }
fn below_ref<R: IndicatorRef>(self, other: R) -> BelowRef<Self, R> { ... }
fn crosses_above(self, threshold: f64) -> CrossesAbove<Self> { ... }
fn crosses_above_ref<R: IndicatorRef>(
self,
other: R,
) -> CrossesAboveRef<Self, R> { ... }
fn crosses_below(self, threshold: f64) -> CrossesBelow<Self> { ... }
fn crosses_below_ref<R: IndicatorRef>(
self,
other: R,
) -> CrossesBelowRef<Self, R> { ... }
fn between(self, low: f64, high: f64) -> Between<Self> { ... }
fn equals(self, value: f64, tolerance: f64) -> Equals<Self> { ... }
}Expand description
Extension trait that adds condition-building methods to all indicator references.
This trait provides a fluent API for building conditions from indicator values.
It is automatically implemented for all types that implement IndicatorRef.
§Example
ⓘ
use finance_query::backtesting::refs::*;
// All these methods are available on any IndicatorRef
let cond1 = rsi(14).above(70.0);
let cond2 = rsi(14).below(30.0);
let cond3 = rsi(14).crosses_above(30.0);
let cond4 = rsi(14).crosses_below(70.0);
let cond5 = rsi(14).between(30.0, 70.0);
let cond6 = sma(10).above_ref(sma(20));
let cond7 = sma(10).crosses_above_ref(sma(20));Provided Methods§
Sourcefn above_ref<R: IndicatorRef>(self, other: R) -> AboveRef<Self, R>
fn above_ref<R: IndicatorRef>(self, other: R) -> AboveRef<Self, R>
Sourcefn below_ref<R: IndicatorRef>(self, other: R) -> BelowRef<Self, R>
fn below_ref<R: IndicatorRef>(self, other: R) -> BelowRef<Self, R>
Sourcefn crosses_above(self, threshold: f64) -> CrossesAbove<Self>
fn crosses_above(self, threshold: f64) -> CrossesAbove<Self>
Sourcefn crosses_above_ref<R: IndicatorRef>(
self,
other: R,
) -> CrossesAboveRef<Self, R>
fn crosses_above_ref<R: IndicatorRef>( self, other: R, ) -> CrossesAboveRef<Self, R>
Sourcefn crosses_below(self, threshold: f64) -> CrossesBelow<Self>
fn crosses_below(self, threshold: f64) -> CrossesBelow<Self>
Sourcefn crosses_below_ref<R: IndicatorRef>(
self,
other: R,
) -> CrossesBelowRef<Self, R>
fn crosses_below_ref<R: IndicatorRef>( self, other: R, ) -> CrossesBelowRef<Self, R>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.