MoneyFlow

Modified on 2008/05/03 08:45 by Administrator — Categorized as: Standard Indicators

Syntax

public MoneyFlow(Bars bars, string description) public static MoneyFlow Series(Bars bars)

Parameter Description

bars The Bars object

Description

Money Flow returns the average price multiplied by volume. Money Flow is the core component of the Money Flow Index (MFI) indicator. This is not really an indicator, but a mathematical function used to construct other indicators.

Interpretation

See the Money Flow Index (MFI) indicator and the example strategy application below.

Calculation

Money Flow is the average price multiplied by Volume.

Money Flow = Volume x AveragePriceC

Example

using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators;

namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { // The example below duplicates the calculation of the MFI double today = 0; double yesterday = 0; DataSeries MFPositive = new DataSeries( Bars, "MFPositive" ); DataSeries MFNegative = new DataSeries( Bars, "MFNegative" ); DataSeries MyMFI = new DataSeries( Bars, "MyMFI" ); DataSeries myAveragePrice = (High+Low+Close)/3; for(int bar = 1; bar < Bars.Count; bar++) { today = myAveragePricebar; yesterday = myAveragePricebar-1; if( today > yesterday ) MFPositivebar = MoneyFlow.Series( Bars )bar; else if( today < yesterday ) MFNegativebar = MoneyFlow.Series( Bars )bar; } DataSeries MFPosSum = Sum.Series( MFPositive, 14 ); DataSeries MFNegSum = Sum.Series( MFNegative, 14 ); DataSeries MoneyRatio = MFPosSum/MFNegSum;

for(int bar = 14; bar < Bars.Count; bar++) MyMFIbar = 100 - ( 100 / ( 1 + MoneyRatiobar ) ); ChartPane MFPane = CreatePane( 30, true, true ); ChartPane MFIPane = CreatePane( 30, true, true ); PlotSeries( MFPane, MyMFI, Color.Navy, WealthLab.LineStyle.Solid, 2 ); PlotSeries( MFIPane, MFI.Series( Bars, 14 ), Color.Brown, WealthLab.LineStyle.Solid, 2 ); } } }