Class: RubyTechnicalAnalysis::WildersSmoothing

Inherits:
Indicator
  • Object
show all
Defined in:
lib/ruby_technical_analysis/indicators/wilders_smoothing.rb

Overview

Wilders Smoothing

Instance Attribute Summary collapse

Attributes inherited from Indicator

#series

Instance Method Summary collapse

Methods inherited from Indicator

call

Constructor Details

#initialize(series: [], period: 5) ⇒ WildersSmoothing

Returns a new instance of WildersSmoothing.

Parameters:

  • series (Array) (defaults to: [])

    An array of prices

  • period (Integer) (defaults to: 5)

    The number of periods to use in the calculation



8
9
10
11
12
# File 'lib/ruby_technical_analysis/indicators/wilders_smoothing.rb', line 8

def initialize(series: [], period: 5)
  @period = period

  super(series: series)
end

Instance Attribute Details

#periodObject (readonly)

Returns the value of attribute period.



4
5
6
# File 'lib/ruby_technical_analysis/indicators/wilders_smoothing.rb', line 4

def period
  @period
end

Instance Method Details

#callFloat

Returns The current Wilders Smoothing value.

Returns:

  • (Float)

    The current Wilders Smoothing value



15
16
17
# File 'lib/ruby_technical_analysis/indicators/wilders_smoothing.rb', line 15

def call
  calculate_wilders_smoothing
end

#valid?Boolean

Returns Whether or not the object is valid.

Returns:

  • (Boolean)

    Whether or not the object is valid



20
21
22
# File 'lib/ruby_technical_analysis/indicators/wilders_smoothing.rb', line 20

def valid?
  period < series.length
end