Class: RubyTechnicalAnalysis::EnvelopesEma
- Defined in:
- lib/ruby_technical_analysis/indicators/envelopes_ema.rb
Overview
Envelopes EMA
Find more information at: www.fidelity.com/learning-center/trading-investing/technical-analysis/technical-indicator-guide/mae
Note that this indicator is similar but not the exact same as the one in the link above. This indicator is based on the EMA, not the SMA.
Instance Attribute Summary collapse
-
#percent ⇒ Object
readonly
Returns the value of attribute percent.
-
#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, middle, and lower bands of the series.
-
#initialize(series: [], period: 20, percent: 5) ⇒ EnvelopesEma
constructor
A new instance of EnvelopesEma.
-
#valid? ⇒ Boolean
Whether or not the object is valid.
Methods inherited from Indicator
Constructor Details
#initialize(series: [], period: 20, percent: 5) ⇒ EnvelopesEma
Returns a new instance of EnvelopesEma.
13 14 15 16 17 18 |
# File 'lib/ruby_technical_analysis/indicators/envelopes_ema.rb', line 13 def initialize(series: [], period: 20, percent: 5) @period = period @percent = percent super(series: series) end |
Instance Attribute Details
#percent ⇒ Object (readonly)
Returns the value of attribute percent.
8 9 10 |
# File 'lib/ruby_technical_analysis/indicators/envelopes_ema.rb', line 8 def percent @percent end |
#period ⇒ Object (readonly)
Returns the value of attribute period.
8 9 10 |
# File 'lib/ruby_technical_analysis/indicators/envelopes_ema.rb', line 8 def period @period end |
Instance Method Details
#call ⇒ Array
Returns An array containing the current upper, middle, and lower bands of the series.
21 22 23 |
# File 'lib/ruby_technical_analysis/indicators/envelopes_ema.rb', line 21 def call caluculate_envelopes_ema end |
#valid? ⇒ Boolean
Returns Whether or not the object is valid.
26 27 28 |
# File 'lib/ruby_technical_analysis/indicators/envelopes_ema.rb', line 26 def valid? period <= series.length && percent <= 100 end |