Class: RubyTechnicalAnalysis::CommodityChannelIndex
- Defined in:
- lib/ruby_technical_analysis/indicators/commodity_channel_index.rb
Overview
Commodity Channel Index
Find more information at: www.fidelity.com/learning-center/trading-investing/technical-analysis/technical-indicator-guide/cci
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 Commodity Channel Index value.
-
#initialize(series: [], period: 20) ⇒ CommodityChannelIndex
constructor
A new instance of CommodityChannelIndex.
-
#valid? ⇒ Boolean
Whether or not the object is valid.
Methods inherited from Indicator
Constructor Details
#initialize(series: [], period: 20) ⇒ CommodityChannelIndex
Returns a new instance of CommodityChannelIndex.
10 11 12 13 14 |
# File 'lib/ruby_technical_analysis/indicators/commodity_channel_index.rb', line 10 def initialize(series: [], period: 20) @period = period 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/commodity_channel_index.rb', line 6 def period @period end |
Instance Method Details
#call ⇒ Float
Returns The current Commodity Channel Index value.
17 18 19 |
# File 'lib/ruby_technical_analysis/indicators/commodity_channel_index.rb', line 17 def call calculate_cci end |
#valid? ⇒ Boolean
Returns Whether or not the object is valid.
22 23 24 |
# File 'lib/ruby_technical_analysis/indicators/commodity_channel_index.rb', line 22 def valid? min_size <= series.length end |