tzutrader
A composable C++ backtesting library for trading strategies (experimental)
Loading...
Searching...
No Matches
tzu::RSI Class Reference

#include <indicators.h>

Inheritance diagram for tzu::RSI:
tzu::Indicator< RSI, Ohlcv, double >

Public Member Functions

 RSI (size_t period)
double get () const noexcept
double update (Ohlcv value)
Public Member Functions inherited from tzu::Indicator< RSI, Ohlcv, double >
double get () const noexcept
double update (Ohlcv value)

Detailed Description

Relative Strength Index (RSI)

Calculates the RSI based on the average gains and losses over a specified period. Returns NaN until enough values have been added to fill the window. Once the window is full, it calculates the RSI using the formula:

RSI = 100 - (100 / (1 + (Average Gain / Average Loss)))

where Average Gain and Average Loss are calculated using the SMA of the gains and losses over the specified period. The N template parameter specifies the size of the window for calculating the average gains and losses.

Constructor & Destructor Documentation

◆ RSI()

tzu::RSI::RSI ( size_t period)
inline

Member Function Documentation

◆ get()

double tzu::RSI::get ( ) const
inlinenoexcept

◆ update()

double tzu::RSI::update ( Ohlcv value)
inline

The documentation for this class was generated from the following file: