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

template<typename T, typename I = unsigned long>
struct AvgDirMovIdxVisitor;

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

template<typename T, typename I = unsigned long>
using adx_v = AvgDirMovIdxVisitor<T, I>;
        
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.

This visitor calculates Average Directional Movement Index (ADX) indicator. It requires 3 input columns in the order of low, high, close.
The result is a vector with the same number of values as the given columns. The first value in result is 0.

Designed by Welles Wilder for commodity daily charts, the ADX is now used in several markets by technical traders to judge the strength of a trend. The ADX makes use of a positive (+DI) and negative (-DI) directional indicator in addition to the trendline. The trend has strength when ADX is above 25; the trend is weak or the price is trendless when ADX is below 20, according to Wilder. Non-trending doesn't mean the price isn't moving. It may not be, but the price could also be making a trend change or is too volatile for a clear direction to be present.
T: Column data type
I: Index type
static void test_AvgDirMovIdxVisitor()  {

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

    typedef StdDataFrame<std::string> StrDataFrame;

    StrDataFrame    df;

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

        adx_v<double, std::string>  adx_v (3, 4);

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

        assert(adx_v.get_result().size() == 1721);
        assert(adx_v.get_result()[0] == 0);
        assert(std::abs(adx_v.get_result()[10] - 0.73029) < 0.00001);
        assert(std::abs(adx_v.get_result()[14] - 0.735792) < 0.000001);
        assert(std::abs(adx_v.get_result()[25] - 0.691082) < 0.000001);
        assert(std::abs(adx_v.get_result()[1720] - 0.372184) < 0.000001);
        assert(std::abs(adx_v.get_result()[1712] - 0.703394) < 0.000001);
        assert(std::abs(adx_v.get_result()[1707] - 0.383002) < 0.000001);
    }
    catch (const DataFrameError &ex)  {
        std::cout << ex.what() << std::endl;
    }
}
C++ DataFrame