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

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

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

template<typename T, typename I = unsigned long>
using t3_v = T3MovingMeanVisitor<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 the T3 Moving Average.
Developed by Tim Tillson, the T3 Moving Average is considered superior to traditional moving averages as it is smoother, more responsive and thus performs better in ranging market conditions as well. However, it bears the disadvantage of overshooting the price as it attempts to realign itself to current market conditions.
It incorporates a smoothing technique which allows it to plot curves more gradual than ordinary moving averages and with a smaller lag. Its smoothness is derived from the fact that it is a weighted sum of a single EMA, double EMA, triple EMA and so on. When a trend is formed, the price action will stay above or below the trend during most of its progression and will hardly be touched by any swings. Thus, a confirmed penetration of the T3 MA and the lack of a following reversal often indicates the end of a trend.
    explicit
    T3MovingMeanVisitor(size_t rolling_period = 10,
                        double volum_factor = 0.7)
        
T: Column data type
I: Index type
static void test_T3MovingMeanVisitor()  {

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

    typedef StdDataFrame<std::string> StrDataFrame;

    StrDataFrame    df;

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

        t3_v<double, std::string>   t3;

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

        assert(t3.get_result().size() == 5031);
        assert(std::abs(t3.get_result()[0] - 98.5625) < 0.0001);
        assert(std::abs(t3.get_result()[12] - 99.065) < 0.001);
        assert(std::abs(t3.get_result()[14] - 99.2797) < 0.0001);
        assert(std::abs(t3.get_result()[20] - 99.3028) < 0.0001);
        assert(std::abs(t3.get_result()[5030] - 116.5671) < 0.0001);
        assert(std::abs(t3.get_result()[5026] - 122.7203) < 0.0001);
    }
    catch (const DataFrameError &ex)  {
        std::cout << ex.what() << std::endl;
    }
}
C++ DataFrame