Class: RubyTechnicalAnalysis::RelativeMomentumIndex
- Defined in:
- lib/ruby_technical_analysis/indicators/relative_momentum_index.rb
Overview
Relative Momentum Index
Instance Attribute Summary collapse
-
#period_mom ⇒ Object
readonly
Returns the value of attribute period_mom.
-
#period_rmi ⇒ Object
readonly
Returns the value of attribute period_rmi.
Attributes inherited from Indicator
Instance Method Summary collapse
-
#call ⇒ Float
The current RMI value.
-
#initialize(series: [], period_mom: 14, period_rmi: 20) ⇒ RelativeMomentumIndex
constructor
A new instance of RelativeMomentumIndex.
-
#valid? ⇒ Boolean
Whether or not the object is valid.
Methods inherited from Indicator
Constructor Details
#initialize(series: [], period_mom: 14, period_rmi: 20) ⇒ RelativeMomentumIndex
Returns a new instance of RelativeMomentumIndex.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/ruby_technical_analysis/indicators/relative_momentum_index.rb', line 9 def initialize(series: [], period_mom: 14, period_rmi: 20) @period_mom = period_mom @period_rmi = period_rmi @rmi = [] @rmi_intermediate = [] @smooth_up = [] @smooth_down = [] @wilders_is_set = false super(series: series) end |
Instance Attribute Details
#period_mom ⇒ Object (readonly)
Returns the value of attribute period_mom.
4 5 6 |
# File 'lib/ruby_technical_analysis/indicators/relative_momentum_index.rb', line 4 def period_mom @period_mom end |
#period_rmi ⇒ Object (readonly)
Returns the value of attribute period_rmi.
4 5 6 |
# File 'lib/ruby_technical_analysis/indicators/relative_momentum_index.rb', line 4 def period_rmi @period_rmi end |
Instance Method Details
#call ⇒ Float
Returns The current RMI value.
22 23 24 |
# File 'lib/ruby_technical_analysis/indicators/relative_momentum_index.rb', line 22 def call calculate_rmi end |
#valid? ⇒ Boolean
Returns Whether or not the object is valid.
27 28 29 |
# File 'lib/ruby_technical_analysis/indicators/relative_momentum_index.rb', line 27 def valid? period_mom + period_rmi <= series.length end |