pub struct OBV { /* private fields */ }Expand description
On Balance Volume (OBV) Indicator
OBV is a momentum indicator that uses volume flow to predict changes in stock price. It adds volume on up days and subtracts volume on down days.
Formula:
- If Close > Previous Close: OBV = Previous OBV + Volume
- If Close < Previous Close: OBV = Previous OBV - Volume
- If Close = Previous Close: OBV = Previous OBV
Implementations§
Source§impl OBV
impl OBV
Sourcepub fn with_config(config: OBVConfig) -> Self
pub fn with_config(config: OBVConfig) -> Self
Create a new OBV calculator with custom configuration
Sourcepub fn calculate(&mut self, input: OBVInput) -> Result<OBVOutput, OBVError>
pub fn calculate(&mut self, input: OBVInput) -> Result<OBVOutput, OBVError>
Calculate OBV for the given input
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OBV
impl RefUnwindSafe for OBV
impl Send for OBV
impl Sync for OBV
impl Unpin for OBV
impl UnwindSafe for OBV
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