Skip to content

Money Flow Index (MFI) ​

Created by Quong and Soudack, the Money Flow Index is a price-volume oscillator that shows buying and selling momentum. Values outside of the 80 / 20 thresholds are considered overbought / oversold. [Discuss] 💬

csharp
// C# usage syntax
IReadOnlyList<MfiResult> results =
  bars.ToMfi(lookbackPeriods);

Parameters ​

paramtypedescription
lookbackPeriodsintNumber of periods (N) in the lookback period. Must be greater than 1. Default is 14.

Historical price bars requirements ​

You must have at least N+1 historical price bars to cover the warmup periods.

bars is a collection of generic TBar historical price bars. It should have a consistent frequency (day, hour, minute, etc). See the Guide for more information.

Response ​

csharp
IReadOnlyList<MfiResult>
  • This method returns a time series of all available indicator values for the bars provided.
  • It always returns the same number of elements as there are in the historical price bars.
  • It does not return a single incremental indicator value.
  • The first N periods will have null MFI values since they cannot be calculated.

MfiResult ​

propertytypedescription
TimestampDateTimeDate from evaluated TBar
MfidoubleMoney Flow Index

Utilities ​

See Utilities and helpers for more information.

Streaming ​

Use the buffer-style List<T> when you need incremental calculations without a hub:

csharp
MfiList mfiList = new(lookbackPeriods);

foreach (IBar bar in bars)  // simulating stream
{
  mfiList.Add(bar);
}

// based on `ICollection<MfiResult>`
IReadOnlyList<MfiResult> results = mfiList;

Subscribe to a BarHub for advanced streaming scenarios:

csharp
BarHub barHub = new();
MfiHub observer = barHub.ToMfiHub(lookbackPeriods);

foreach (IBar bar in bars)  // simulating stream
{
  barHub.Add(bar);
}

IReadOnlyList<MfiResult> results = observer.Results;

See Buffer lists and Stream hubs for full usage guides.

Chaining ​

Results can be further processed on Mfi with additional chain-enabled indicators.

csharp
// example
var results = bars
    .ToMfi(..)
    .ToRsi(..);

This indicator must be generated from bars and cannot be generated from results of another chain-enabled indicator or method.

See Chaining indicators for more.