Indicators
Relative Strength Index
Description
The Relative Strength Index (RSI) is a momentum indicator used in technical analysis that measures the magnitude of recent price changes to evaluate overbought or oversold conditions in the price of a stock or other asset. The RSI is displayed as an oscillator (a line graph that moves between two extremes) and can have a reading from 0 to 100. The indicator was originally developed by J. Welles Wilder Jr. and introduced in his seminal 1978 book, “New Concepts in Technical Trading Systems.”
For more information, please visit Investopedia.
Params & Instance Methods
#initialize @param series [Array] An array of prices, typically closing prices @param period [Integer] The number of periods to use in the calculation - default is 14 #call @return [Float] The current RSI value #valid? @return [Boolean] Whether or not the object is valid
Example
require 'ruby-technical-analysis' series = [37.875, 39.5, 38.75, 39.8125, 40, 39.875] period = 5 relative_strength_index = RubyTechnicalAnalysis::RelativeStrengthIndex.new( series: series, period: period ) p relative_strength_index.valid? # true p relative_strength_index.call # 76.6667