CMF

Modified on 2008/04/14 09:54 by Administrator — Categorized as: Standard Indicators

Syntax

public CMF(Bars bars, int period, string description) public static CMF Series(Bars bars, int period)

Parameter Description

bars The Bars object
period Indicator calculation period

Description

Chaikin Money Flow (CMF) is a volume weighted average of Accumulation/Distribution over the specified period. The standard CMF period is 21 days. The principle behind the Chaikin Money Flow, is the nearer the close is to the high, the more accumulation has taken place. Conversely the nearer the close is to the low, the more distribution has taken place. If the price action consistently closes above the bar's midpoint on increasing volume then the Chaikin Money Flow will be positive. Conversely, if the price action consistently closes below the bar's midpoint on increasing volume, then the Chaikin Money Flow will be a negative value.

Interpretation





Calculation

CMF = n-day Sum of ( ( ( (C - L) - (H - C) ) / (H - L) ) x Vol ) / n-day Sum of Vol

where,
n = number of periods, typically 21
H = high
L = low
C = close
Vol = volume


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 { // Thank you fundtimer public Color WS4ColorToNET( double WS4Color ) { return Color.FromArgb( (int)Math.Floor( ( WS4Color % 1000 ) / 100 * 28.4 ), (int)Math.Floor( ( WS4Color % 100 ) / 10 * 28.4 ), (int)Math.Floor( WS4Color % 10 * 28.4 ) ); } protected override void Execute() { // Use strength of CMF above zero to color bars double x = 0; ChartPane CMFPane = CreatePane( 40, true, true ); PlotSeries( CMFPane, CMF.Series( Bars, 20 ), Color.Blue, WealthLab.LineStyle.Histogram, 1 ); SetBarColors( Color.Silver, Color.Silver ); for(int bar = 20; bar < Bars.Count; bar++) { x = CMF.Series( Bars, 20 )bar * 20; if( x > 0 ) SetBarColor( bar, WS4ColorToNET( x ) ); } } } }