Indicators

Chaikin Money Flow


Description

Money flow is calculated by averaging the high, low and closing prices, and multiplying by the daily volume. Comparing that result with the number for the previous day tells traders whether money flow was positive or negative for the current day. Positive money flow indicates that prices are likely to move higher, while negative money flow suggests prices are about to fall.

For more information, please visit Investopedia.


Params & Instance Methods

#initialize
@param series [Array] An array of arrays containing high, low, close, and volume information, e.g. [[high, low, close, volume], [high, low, close, volume]]
@param period [Integer] The number of periods to use in the calculation - default is 21

#call
@return [Float] The current Chaikin Money Flow value

#valid?
@return [Boolean] Whether or not the object is valid

Example

require 'ruby-technical-analysis'

series = [[8.625, 8.3125, 8.625, 4494], [8.625, 8.4375, 8.5, 2090], [8.625, 8.4375, 8.625, 1306],
          [8.75, 8.625, 8.75, 4242], [8.75, 8.4375, 8.5, 2874]]
period = 5

chaikin_money_flow = 
  RubyTechnicalAnalysis::ChaikinMoneyFlow.new(
    series: series,
    period: period
  )

p chaikin_money_flow.valid? # true

p chaikin_money_flow.call.truncate(5) # 0.50786