Indicators

Mass Index


Description

Mass Index (MI) is a form of technical analysis that examines the range between high and low stock prices over a period of time. Mass index, developed by Donald Dorsey in the early 1990s, suggests that a reversal of the current trend will likely take place when the range widens beyond a certain point and then contracts.

For more information, please visit Investopedia.


Params & Instance Methods

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

#call
@return [Float] The current Mass Index value

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

Example

require 'ruby-technical-analysis'

series = [[38.125, 37.75], [38, 37.75], [37.9375, 37.8125], [37.875, 37.625], [38.125, 37.5],
          [38.125, 37.5], [37.75, 37.5], [37.625, 37.4375], [37.6875, 37.375], [37.5, 37.375],
          [37.5625, 37.375], [37.625, 36.8125], [36.6875, 36.3125], [36.875, 36.25], [36.9375, 36.5],
          [36.5, 36.25], [36.9375, 36.3125], [37, 36.625], [36.875, 36.5625]]
period = 9

mass_index = 
  RubyTechnicalAnalysis::MassIndex.new(
    series: series,
    period: period
  )

p mass_index.valid? # true

p mass_index.call # 3.2236
Previous
MACD