pub struct CloseMidpointDiff { /* private fields */ }Expand description
Close-Midpoint Difference — close - (high + low) / 2.
Measures where the close lands relative to the center of the bar’s range:
- Positive: close is above the midpoint (bullish close within the bar).
- Negative: close is below the midpoint (bearish close within the bar).
- Zero: close exactly at the midpoint.
This is a period-1 indicator that emits on every bar.
§Example
use fin_primitives::signals::indicators::CloseMidpointDiff;
use fin_primitives::signals::Signal;
let cmd = CloseMidpointDiff::new("cmd");
assert_eq!(cmd.period(), 1);Implementations§
Trait Implementations§
Source§impl Signal for CloseMidpointDiff
impl Signal for CloseMidpointDiff
Source§fn period(&self) -> usize
fn period(&self) -> usize
Returns the number of bars required before the signal produces a value.
Source§fn is_ready(&self) -> bool
fn is_ready(&self) -> bool
Returns
true if the signal has accumulated enough bars to produce a value.Source§fn reset(&mut self)
fn reset(&mut self)
Resets the signal to its initial state as if no bars had been seen. Read more
Source§fn update_bar(&mut self, bar: &OhlcvBar) -> Result<SignalValue, FinError>
fn update_bar(&mut self, bar: &OhlcvBar) -> Result<SignalValue, FinError>
Auto Trait Implementations§
impl Freeze for CloseMidpointDiff
impl RefUnwindSafe for CloseMidpointDiff
impl Send for CloseMidpointDiff
impl Sync for CloseMidpointDiff
impl Unpin for CloseMidpointDiff
impl UnsafeUnpin for CloseMidpointDiff
impl UnwindSafe for CloseMidpointDiff
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