Chaikin Money Flow
Created by Marc Chaikin, Chaikin Money Flow is calculated using the daily readings of the Chaikin Accumulation/Distribution Line, the premise of which is that the degree of buying or selling pressure can be determined by the location of the Close relative to the High and Low for a period. There is buying pressure when a stock closes in the upper half of a period's range and there is selling pressure when a stock closes in the lower half of the period's trading range. The price close location relative to the period high and low is represented by a value, which is ultimately multiplied by volume to form the Accumulation/Distribution Value for each period.
The Chaikin Money Flow oscillator is the cumulative total of the Accumulation/Distribution Values for x periods divided by the cumulative total of volume for those x periods.
High values with long durations can be interpreted as bullish readings.
Read more about Chaikin Money Flow at ChaikinAnalytics.com
x is the period which must be an integer.
z is the offset. An offset of 1 would be 1 bar ago.
An indicator formula for the current Chaikin Money Flow 21 can be written as follows.
AVG((2 * C0 - L0 - H0) / (H0 - L0 - (H0 = L0)) * V0, 21) / (AVGV21.0 - (AVGV21.0 = 0))
But you leave off the offset parameter if you are just interested in the current value.
AVG((2 * C - L - H) / (H - L - (H = L)) * V, 21) / (AVGV21 - (AVGV21 = 0))
Getting the value for the previous bar would involve adding back the offset parameter and setting it to 1.
AVG((2 * C1 - L1 - H1) / (H1 - L1 - (H1 = L1)) * V1, 21) / (AVGV21.1 - (AVGV21.1 = 0))