Skip to main content

Mfi

Struct Mfi 

Source
pub struct Mfi { /* private fields */ }
Expand description

Money Flow Index, smoothed, with a signal line.

Per bar the raw money flow is typical * volume, typical = (high + low + close) / 3; it counts as positive when the typical price rose against the previous bar, negative when it fell, and not at all on the first bar or when unchanged. Over the last mfi_len bars raw = 100 - 100 / (1 + positive / negative), with 50 without any flow, 100 without negative and 0 without positive flow. value is the line, Ema(avg_len) of the raw MFI with the first-sample seed; extra["signal"] is Ema(sig_len) of the line. Alerts require volume.

First output: with the mfi_len-th bar. Indicator::reset clears the window and averages.

Implementations§

Source§

impl Mfi

Source

pub fn new( mfi_len: usize, avg_len: usize, sig_len: usize, mid_line: f64, overbought: f64, oversold: f64, lookback_extreme: usize, require_extreme_zone: bool, ) -> Self

Source

pub fn with_defaults() -> Self

Trait Implementations§

Source§

impl Indicator for Mfi

Source§

fn name(&self) -> &str

Source§

fn warmup_period(&self) -> usize

Source§

fn on_bar(&mut self, bar: &Bar) -> Option<IndicatorOutput>

Source§

fn reset(&mut self)

Source§

fn alerts(&self) -> Vec<IndicatorAlert>

Source§

fn on_checked_bar( &mut self, bar: &Bar, ) -> Result<Option<IndicatorOutput>, BarValidationError>

Validates a bar before forwarding it to Indicator::on_bar.

Auto Trait Implementations§

§

impl Freeze for Mfi

§

impl RefUnwindSafe for Mfi

§

impl Send for Mfi

§

impl Sync for Mfi

§

impl Unpin for Mfi

§

impl UnsafeUnpin for Mfi

§

impl UnwindSafe for Mfi

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.