Class: RubyTechnicalAnalysis::WilliamsPercentR
- Defined in:
- lib/ruby_technical_analysis/indicators/williams_percent_r.rb
Overview
Williams %R
Find more information at: www.fidelity.com/learning-center/trading-investing/technical-analysis/technical-indicator-guide/williams-r
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 Williams %R value.
-
#initialize(series: [], period: 14) ⇒ WilliamsPercentR
constructor
A new instance of WilliamsPercentR.
-
#valid? ⇒ Boolean
Whether or not the object is valid.
Methods inherited from Indicator
Constructor Details
#initialize(series: [], period: 14) ⇒ WilliamsPercentR
Returns a new instance of WilliamsPercentR.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/ruby_technical_analysis/indicators/williams_percent_r.rb', line 10 def initialize(series: [], period: 14) @period = period @highest_highs = [] @lowest_lows = [] @highest_highs_minus_close = [] @highest_highs_minus_lowest_lows = [] @pct_r = [] 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/williams_percent_r.rb', line 6 def period @period end |
Instance Method Details
#call ⇒ Float
Returns The current Williams %R value.
22 23 24 |
# File 'lib/ruby_technical_analysis/indicators/williams_percent_r.rb', line 22 def call calculate_williams_percent_r end |
#valid? ⇒ Boolean
Returns Whether or not the object is valid.
27 28 29 |
# File 'lib/ruby_technical_analysis/indicators/williams_percent_r.rb', line 27 def valid? period < series.length end |