Class: RubyTechnicalAnalysis::PriceChannel
- Defined in:
- lib/ruby_technical_analysis/indicators/price_channel.rb
Overview
Price Channel
Find more information at: www.investopedia.com/terms/p/price-channel.asp
Instance Attribute Summary collapse
-
#period ⇒ Object
readonly
Returns the value of attribute period.
Attributes inherited from Indicator
Instance Method Summary collapse
-
#call ⇒ Array
An array containing the current upper and lower price channel values.
-
#initialize(series: [], period: 20) ⇒ PriceChannel
constructor
A new instance of PriceChannel.
-
#valid? ⇒ Boolean
Whether the object is valid.
Methods inherited from Indicator
Constructor Details
#initialize(series: [], period: 20) ⇒ PriceChannel
Returns a new instance of PriceChannel.
10 11 12 13 14 |
# File 'lib/ruby_technical_analysis/indicators/price_channel.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/price_channel.rb', line 6 def period @period end |
Instance Method Details
#call ⇒ Array
Returns An array containing the current upper and lower price channel values.
17 18 19 |
# File 'lib/ruby_technical_analysis/indicators/price_channel.rb', line 17 def call calculate_price_channel end |
#valid? ⇒ Boolean
Returns Whether the object is valid.
22 23 24 |
# File 'lib/ruby_technical_analysis/indicators/price_channel.rb', line 22 def valid? series.length >= period end |