Chaikin Money Flow in EasyLanguage is a short study built from the money flow
multiplier and a couple of Summation calls. See
the explainer for the concept.
What you’ll need
- TradeStation or MultiCharts
- The EasyLanguage / PowerLanguage Editor, new Indicator
The source
{ AlgoGen Chaikin Money Flow — TradeStation / MultiCharts }
inputs:
Length( 20 );
variables:
Rng( 0 ), MFM( 0 ), MFV( 0 ), CMFval( 0 );
Rng = High - Low;
if Rng = 0 then
MFM = 0
else
MFM = ( ( Close - Low ) - ( High - Close ) ) / Rng;
MFV = MFM * Volume;
if Summation( Volume, Length ) <> 0 then
CMFval = Summation( MFV, Length ) / Summation( Volume, Length )
else
CMFval = 0;
Plot1( CMFval, "CMF" );
Plot2( 0, "Zero" );
if CMFval >= 0 then SetPlotColor( 1, Green ) else SetPlotColor( 1, Red );
MFM is the close-location value, MFV weights it by volume, and Summation(..., Length) gives the rolling sums that CMF divides — the zero-centered oscillator from
the output chart. Colouring by sign shows accumulation vs distribution at a glance.
Using CMF as a filter
CMF works best gating another signal rather than firing alone. Here it filters a simple entry so you only buy while money flow confirms accumulation:
{ In a Strategy — CMF-confirmed entries }
inputs: Length( 20 ), FastLen( 10 ), SlowLen( 30 );
variables: CMFval( 0 );
{ ...compute CMFval as in the study above... }
if CMFval > 0.05
and Average( Close, FastLen ) crosses over Average( Close, SlowLen ) then
Buy next bar at market;
if CMFval < 0 then
Sell next bar at market;
Only take the moving-average cross when CMF confirms buying pressure, and exit when money flow turns negative. The Strategy Performance Report shows whether the confirmation adds value.
Gotchas
- Flat-bar guard.
Rng = 0would divide by zero; setMFM = 0for those bars. Summation, then divide. CMF sums money flow volume and volume separately overLength, then divides — don’t average per-bar ratios.VolumevsTicks. Use real volume where available; on intraday bars confirm whetherVolumereturns shares/contracts or tick counts, as CMF needs true volume to mean anything.
Same indicator elsewhere: Python, MQL5, Pine Script, NinjaScript. Then backtest it in AlgoGen.
This post is educational, not financial advice. Indicators describe the past; they don’t predict the future. Backtest anything before you risk real money on it.
Sources and further reading
- What is EasyLanguage? (TradeStation)
