Class: RubyTechnicalAnalysis::VolumeOscillator
- Defined in:
- lib/ruby_technical_analysis/indicators/volume_oscillator.rb
Overview
Volume Oscillator
Find more information at: www.fidelity.com/learning-center/trading-investing/technical-analysis/technical-indicator-guide/volume-oscillator
Instance Attribute Summary collapse
-
#long_ma_period ⇒ Object
readonly
Returns the value of attribute long_ma_period.
-
#short_ma_period ⇒ Object
readonly
Returns the value of attribute short_ma_period.
Attributes inherited from Indicator
Instance Method Summary collapse
-
#call ⇒ Float
The current volume oscillator value.
-
#initialize(series: [], short_ma_period: 20, long_ma_period: 60) ⇒ VolumeOscillator
constructor
A new instance of VolumeOscillator.
-
#valid? ⇒ Boolean
Whether or not the object is valid.
Methods inherited from Indicator
Constructor Details
#initialize(series: [], short_ma_period: 20, long_ma_period: 60) ⇒ VolumeOscillator
Returns a new instance of VolumeOscillator.
11 12 13 14 15 16 |
# File 'lib/ruby_technical_analysis/indicators/volume_oscillator.rb', line 11 def initialize(series: [], short_ma_period: 20, long_ma_period: 60) @short_ma_period = short_ma_period @long_ma_period = long_ma_period super(series: series) end |
Instance Attribute Details
#long_ma_period ⇒ Object (readonly)
Returns the value of attribute long_ma_period.
6 7 8 |
# File 'lib/ruby_technical_analysis/indicators/volume_oscillator.rb', line 6 def long_ma_period @long_ma_period end |
#short_ma_period ⇒ Object (readonly)
Returns the value of attribute short_ma_period.
6 7 8 |
# File 'lib/ruby_technical_analysis/indicators/volume_oscillator.rb', line 6 def short_ma_period @short_ma_period end |
Instance Method Details
#call ⇒ Float
Returns The current volume oscillator value.
19 20 21 |
# File 'lib/ruby_technical_analysis/indicators/volume_oscillator.rb', line 19 def call calculate_volume_oscillator end |
#valid? ⇒ Boolean
Returns Whether or not the object is valid.
24 25 26 |
# File 'lib/ruby_technical_analysis/indicators/volume_oscillator.rb', line 24 def valid? short_ma_period < long_ma_period && long_ma_period <= series.length end |