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

template<typename T, typename I = unsigned long,
         std::size_t A = 0>
struct InertiaVisitor;

// -------------------------------------

template<typename T, typename I = unsigned long,
         std::size_t A = 0>
using iner_v = InertiaVisitor<T, I, A>;
        
This is a “single action visitor”, meaning it is passed the whole data vector in one call and you must use the single_act_visit() interface.

Inertia was developed by Donald Dorsey and was introduced his article in September 1995 and mostly used in FOREX markets.
The Inertia indicator takes its name from the realm of physics. Used to describe the tendency of a body in motion to stay in motion until acted upon by an outside force, in stock market it is used to measure the momentum of a stock based upon its volatility. Inertia is measured on a scale from 0 to 100. Negative inertia is seen if the indicator is below 50. If the indicator is above 50, it is said to have positive inertia. Signs of positive inertia are indicative of a long-term upward trend. Signs of negative inertia illustrate long-term downtrends. It's one of few indicators that is simple yet extremely powerful and can be very rewarding if used correctly. One of the most important things to remember about using inertia correctly is to have patience.
The input columns to this visitor are close, high, and low.
    explicit
    InertiaVisitor(size_type roll_period = 20, size_type rvi_roll_period = 14);
        
T: Column data type.
I: Index type.
A: Memory alignment boundary for vectors. Default is system default alignment
static void test_InertiaVisitor()  {

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

    StrDataFrame    df;

    try  {
        df.read("data/SHORT_IBM.csv", io_format::csv2);

        iner_v<double, std::string> inertia;

        df.single_act_visit<double, double, double>("IBM_Close", "IBM_High", "IBM_Low", inertia);

        assert(inertia.get_result().size() == 1721);
        assert(std::isnan(inertia.get_result()[0]));
        assert(std::isnan(inertia.get_result()[32]));
        assert(std::abs(inertia.get_result()[33] - 52.3049) < 0.0001);
        assert(std::abs(inertia.get_result()[40] - 67.6324) < 0.0001);
        assert(std::abs(inertia.get_result()[42] - 66.2179) < 0.0001);
        assert(std::abs(inertia.get_result()[48] - 63.4547) < 0.0001);
        assert(std::abs(inertia.get_result()[50] - 59.4562) < 0.0001);
        assert(std::abs(inertia.get_result()[1720] - 29.7343) < 0.0001);
        assert(std::abs(inertia.get_result()[1712] - 42.2897) < 0.0001);
        assert(std::abs(inertia.get_result()[1707] - 50.3479) < 0.0001);
    }
    catch (const DataFrameError &ex)  {
        std::cout << ex.what() << std::endl;
    }
}
C++ DataFrame