pub struct ATR { /* private fields */ }Expand description
Average True Range (ATR) Calculator
ATR measures market volatility by calculating the average of true ranges over a period. True Range is the greatest of:
- Current High - Current Low
- |Current High - Previous Close|
- |Current Low - Previous Close|
Implementations§
Source§impl ATR
impl ATR
Sourcepub fn new(period: usize) -> Result<Self, ATRError>
pub fn new(period: usize) -> Result<Self, ATRError>
Creates a new ATR calculator with the specified period
Sourcepub fn update_hlc(
&mut self,
high: f64,
low: f64,
close: f64,
) -> Option<ATRResult>
pub fn update_hlc( &mut self, high: f64, low: f64, close: f64, ) -> Option<ATRResult>
Updates ATR with separate high, low, close values
Sourcepub fn update_close_only(&mut self, close: f64) -> Option<ATRResult>
pub fn update_close_only(&mut self, close: f64) -> Option<ATRResult>
Calculate with just closing price (simplified - less accurate)
Auto Trait Implementations§
impl Freeze for ATR
impl RefUnwindSafe for ATR
impl Send for ATR
impl Sync for ATR
impl Unpin for ATR
impl UnwindSafe for ATR
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