Signature Description Parameters
#include <DataFrame/DataFrameStatsVisitors.h>

template<typename T,
         typename I = unsigned long,
         typename =
             typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
struct RSIVisitor;
        
Relative Strength Index (RSI) is a technical indicator used in the analysis of financial markets. It is intended to chart the current and historical strength or weakness of a stock or market based on the closing prices of a recent trading period. The indicator should not be confused with relative strength.
The RSI is classified as a momentum oscillator, measuring the velocity and magnitude of price movements.
The RSI is most typically used on a 14-day (a parameter in this visitor) time frame, measured on a scale from 0 to 100.
Traditional interpretation and usage of the RSI are that values of 70 or above indicate that a security is becoming overbought or overvalued and may be primed for a trend reversal or corrective pullback in price. An RSI reading of 30 or below indicates an oversold or undervalued condition.

NOTE: The input (column) to this visitor is assumed to be instrument prices.
NOTE: The length of the result vector is length of column - avg_period.

explicit RSIVisitor(return_policy rp, size_type avg_period = 14)
T: Column data type.
I: Index type.
static void test_RSIVisitor()  {

    std::cout << "\nTesting RSIVisitor{  } ..." << std::endl;

    const size_t            item_cnt = 32;
    MyDataFrame             df;
    RandGenParams<double>   p;

    p.mean = 5.6;
    p.std = 0.5;
    p.seed = 123;
    p.min_value = 0;
    p.max_value = 8;

    df.load_data(MyDataFrame::gen_sequence_index(0, item_cnt, 1),
                 std::make_pair("normal", gen_normal_dist<double>(item_cnt, p)));

    RSIVisitor<double>  rsi(return_policy::percentage);
    const auto          rsi_result = df.single_act_visit<double>("normal", rsi).get_result();
    std::vector<double> result {
        61.7415, 60.4834, 61.9366, 59.6913, 57.6219, 60.7955, 59.3452, 59.975,
        58.261, 52.4888, 54.3424, 55.912, 54.6126, 54.3072, 52.3504, 56.7229, 52.4376, 51.8158 };

    for (size_t idx = 0; idx < result.size(); ++idx)
       assert(fabs(result[idx] - rsi_result[idx]) < 0.0001);
}