public MFI(Bars bars, int period, string description)
public static MFI Series(Bars bars, int period)
||The Bars object
||Indicator calculation period
Money Flow Index measures the flow of money into and out of a security over the specified Period. Its calculation is similar to that of the Relative Strength Index (RSI)
, but takes volume into account in its calculation. The indicator is calculated by accumulating positive and negative Money Flow values (see Money Flow indicator
), then creating a Money Ratio. The Money Ratio is then normalized into the MFI oscillator form.
- Look for oversold levels below 20 and overbought levels above 80. These normally occur before the underlying price chart forms a top or a bottom. Levels may change depending on market conditions. Ensure that the level lines cut across the highest peaks and the lowest troughs. During strong trends the MFI may remain in overbought or oversold for extended periods.
- If underlying price makes a new high or low that isn't confirmed by the MFI, this divergence can signal a price reversal. MFI divergences from price indicates very strong buy or sell signal.
- The mid point level of 50 will often act as support or resistance if the FMI bounce off the 50 level. Crosses of the 50 level can be used as a buying or selling signal. When MFI cross above then buy, when FMI crosses below then sell.
The follow steps are used to calculate Money Flow Index. See MoneyFlow
for an excellent example script showing the construction of the MFI.
Money Flow = Volume x AveragePriceC
Money Flow direction: if today's average price is greater than yesterday's, then it is considered positive money flow, otherwise it is negative money flow.
Positive Money Flow = Sum all the Positive Money Flows day over specified periods.
Negative Money Flow = Sum all the Negative Money Flows day over specified periods.
Money Ratio = Sum of Positive Money Flow / Sum of Negative Money Flow
Money Flow Index (MFI) = 100 - ( 100 / ( 1 + Money Ratio ) )
public class MyStrategy : WealthScript
protected override void Execute()
The trading system below buys a position whenever MFI crosses below 20.
It sells all open positions as soon as MFI crosses above 80.
The Strategy also colors MFI bars red and green to show oversold/overbought levels.
DataSeries mfi = MFI.Series( Bars, 14 );
ChartPane mfiPane = CreatePane( 50, true, true );
PlotSeries( mfiPane, mfi, Color.Black, WealthLab.LineStyle.Solid, 2 );
SetBarColors( Color.Silver, Color.Silver );
for(int bar = 50; bar < Bars.Count; bar++)
if( CrossUnder( bar, mfi, 20 ) )
BuyAtMarket( bar+1 );
// Let's work directly with the list of active positions
if( CrossOver( bar, mfi, 80 ) )
for( int p = ActivePositions.Count - 1; p > -1 ; p-- )
SellAtMarket( bar+1, ActivePositions[p], "MFI" );
if( mfi[bar] < 20 ) SetSeriesBarColor( bar, mfi, Color.Red );
if( mfi[bar] > 80 ) SetSeriesBarColor( bar, mfi, Color.Green );