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

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

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

template<typename T, typename I = unsigned long,
         std::size_t A = 0>
using coppc_v = CoppockCurveVisitor<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.

The Coppock Curve is a long-term price momentum indicator used primarily to recognize major downturns and upturns in a stock market index. It is calculated as a 10-month weighted moving average of the sum of the 14-month rate of change and the 11-month rate of change for the index. It is also known as the "Coppock Guide." The Coppock formula was introduced in Barron's in 1962 by Edwin Coppock.
The result is a vector of values with same number of items as the given column. The first roc_long items, in the result, will be NAN.
    explicit
    CoppockCurveVisitor(size_t roc_long = 14,
                        size_t roc_short = 11,
                        size_t wma_period = 10)
        
T: Column data type
I: Index type
A: Memory alignment boundary for vectors. Default is system default alignment
static void test_CoppockCurveVisitor()  {

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

    typedef StdDataFrame<std::string> StrDataFrame;

    StrDataFrame    df;

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

        coppc_v<double, std::string>  copp;

        df.single_act_visit<double>("IBM_Close", copp);

        assert(copp.get_result().size() == 1721);
        assert(std::isnan(copp.get_result()[0]));
        assert(std::abs(copp.get_result()[14] - -0.051884971603) < 0.0000001);
        assert(std::abs(copp.get_result()[18] - -0.100660882748) < 0.0000001);
        assert(std::abs(copp.get_result()[25] - -0.124090378548) < 0.0000001);
        assert(std::abs(copp.get_result()[1720] - -0.219247796696) < 0.0000001);
        assert(std::abs(copp.get_result()[1712] - 0.0630742594051) < 0.0000001);
        assert(std::abs(copp.get_result()[1707] - 0.0766481878384) < 0.0000001);
    }
    catch (const DataFrameError &ex)  {
        std::cout << ex.what() << std::endl;
    }
}
C++ DataFrame