pub struct MFI { /* private fields */ }Expand description
Money Flow Index (MFI) Indicator
MFI is a momentum indicator that uses both price and volume to identify overbought or oversold conditions. It’s often called “Volume-weighted RSI”.
Formula:
- Typical Price = (High + Low + Close) / 3
- Raw Money Flow = Typical Price × Volume
- Money Flow Direction: Positive if current TP > previous TP, else Negative
- Money Ratio = (Positive Money Flow Sum) / (Negative Money Flow Sum)
- MFI = 100 - (100 / (1 + Money Ratio))
Implementations§
Source§impl MFI
impl MFI
Sourcepub fn with_period(period: usize) -> Result<Self, MFIError>
pub fn with_period(period: usize) -> Result<Self, MFIError>
Create a new MFI calculator with custom period
Sourcepub fn with_config(config: MFIConfig) -> Self
pub fn with_config(config: MFIConfig) -> Self
Create a new MFI calculator with custom configuration
Sourcepub fn calculate(&mut self, input: MFIInput) -> Result<MFIOutput, MFIError>
pub fn calculate(&mut self, input: MFIInput) -> Result<MFIOutput, MFIError>
Calculate MFI for the given input
Sourcepub fn calculate_batch(
&mut self,
inputs: &[MFIInput],
) -> Result<Vec<MFIOutput>, MFIError>
pub fn calculate_batch( &mut self, inputs: &[MFIInput], ) -> Result<Vec<MFIOutput>, MFIError>
Calculate MFI for a batch of inputs
Sourcepub fn positive_money_flow(&self) -> f64
pub fn positive_money_flow(&self) -> f64
Get current positive money flow sum
Sourcepub fn negative_money_flow(&self) -> f64
pub fn negative_money_flow(&self) -> f64
Get current negative money flow sum
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MFI
impl RefUnwindSafe for MFI
impl Send for MFI
impl Sync for MFI
impl Unpin for MFI
impl UnwindSafe for MFI
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