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