Class: RubyTechnicalAnalysis::BollingerBands
- Defined in:
- lib/ruby_technical_analysis/indicators/bollinger_bands.rb
Overview
Bollinger Bands
Find more information at: www.fidelity.com/learning-center/trading-investing/technical-analysis/technical-indicator-guide/bollinger-bands
Instance Attribute Summary collapse
-
#period ⇒ Object
readonly
Returns the value of attribute period.
-
#standard_deviations ⇒ Object
readonly
Returns the value of attribute standard_deviations.
Attributes inherited from Indicator
Instance Method Summary collapse
-
#call ⇒ Array
An array containing the current upper, middle, and lower bands of the series.
-
#initialize(series: [], period: 20, standard_deviations: 2) ⇒ BollingerBands
constructor
A new instance of BollingerBands.
-
#valid? ⇒ Boolean
Whether or not the object is valid.
Methods inherited from Indicator
Constructor Details
#initialize(series: [], period: 20, standard_deviations: 2) ⇒ BollingerBands
Returns a new instance of BollingerBands.
11 12 13 14 15 16 |
# File 'lib/ruby_technical_analysis/indicators/bollinger_bands.rb', line 11 def initialize(series: [], period: 20, standard_deviations: 2) @period = period @standard_deviations = standard_deviations 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/bollinger_bands.rb', line 6 def period @period end |
#standard_deviations ⇒ Object (readonly)
Returns the value of attribute standard_deviations.
6 7 8 |
# File 'lib/ruby_technical_analysis/indicators/bollinger_bands.rb', line 6 def standard_deviations @standard_deviations end |
Instance Method Details
#call ⇒ Array
Returns An array containing the current upper, middle, and lower bands of the series.
19 20 21 |
# File 'lib/ruby_technical_analysis/indicators/bollinger_bands.rb', line 19 def call calculate_bollinger_bands end |
#valid? ⇒ Boolean
Returns Whether or not the object is valid.
24 25 26 |
# File 'lib/ruby_technical_analysis/indicators/bollinger_bands.rb', line 24 def valid? period <= series.length && standard_deviations > 0 end |