pub struct EfficiencyRatio { /* private fields */ }Expand description
Kaufman Efficiency Ratio indicator.
Implementations§
Source§impl EfficiencyRatio
impl EfficiencyRatio
Sourcepub fn new(lookback: usize) -> Result<Self, IndicatorError>
pub fn new(lookback: usize) -> Result<Self, IndicatorError>
Create a new EfficiencyRatio with the specified lookback period.
§Errors
Returns InvalidParameter if lookback is 0.
Sourcepub fn compute_ratio(
&self,
candles: &[Candle],
) -> Result<Decimal, IndicatorError>
pub fn compute_ratio( &self, candles: &[Candle], ) -> Result<Decimal, IndicatorError>
Compute the ER from the last lookback candles.
Returns a single Decimal in [0, 1].
Sourcepub fn compute_from_closes(
&self,
closes: &[Decimal],
) -> Result<Decimal, IndicatorError>
pub fn compute_from_closes( &self, closes: &[Decimal], ) -> Result<Decimal, IndicatorError>
Compute ER from a slice of close prices.
Requires at least lookback + 1 close prices (same as compute_ratio).
Useful when only close prices are available (e.g., ring buffer).
Trait Implementations§
Source§impl Clone for EfficiencyRatio
impl Clone for EfficiencyRatio
Source§fn clone(&self) -> EfficiencyRatio
fn clone(&self) -> EfficiencyRatio
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EfficiencyRatio
impl Debug for EfficiencyRatio
Source§impl Indicator for EfficiencyRatio
impl Indicator for EfficiencyRatio
Auto Trait Implementations§
impl Freeze for EfficiencyRatio
impl RefUnwindSafe for EfficiencyRatio
impl Send for EfficiencyRatio
impl Sync for EfficiencyRatio
impl Unpin for EfficiencyRatio
impl UnsafeUnpin for EfficiencyRatio
impl UnwindSafe for EfficiencyRatio
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