Class: RubyTechnicalAnalysis::VolumeRateOfChange

Inherits:
Indicator
  • Object
show all
Defined in:
lib/ruby_technical_analysis/indicators/volume_rate_of_change.rb

Overview

Volume Rate of Change

Find more information at: www.investopedia.com/articles/technical/02/091002.asp

Instance Attribute Summary collapse

Attributes inherited from Indicator

#series

Instance Method Summary collapse

Methods inherited from Indicator

call

Constructor Details

#initialize(series: [], period: 25) ⇒ VolumeRateOfChange

Returns a new instance of VolumeRateOfChange.

Parameters:

  • series (Array) (defaults to: [])

    An array of volume values

  • period (Integer) (defaults to: 25)

    The number of periods to use in the calculation



10
11
12
13
14
# File 'lib/ruby_technical_analysis/indicators/volume_rate_of_change.rb', line 10

def initialize(series: [], period: 25)
  @period = period

  super(series: series)
end

Instance Attribute Details

#periodObject (readonly)

Returns the value of attribute period.



6
7
8
# File 'lib/ruby_technical_analysis/indicators/volume_rate_of_change.rb', line 6

def period
  @period
end

Instance Method Details

#callFloat

Returns The current volume rate of change value.

Returns:

  • (Float)

    The current volume rate of change value



17
18
19
# File 'lib/ruby_technical_analysis/indicators/volume_rate_of_change.rb', line 17

def call
  calculate_volume_rate_of_change
end

#valid?Boolean

Returns Whether or not the object is valid.

Returns:

  • (Boolean)

    Whether or not the object is valid



22
23
24
# File 'lib/ruby_technical_analysis/indicators/volume_rate_of_change.rb', line 22

def valid?
  period < series.length
end