templat<typename S_RT, typename L_RT, typename T, typename I = unsigned long, typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
struct DoubleCrossOver;
|
This is a “single action visitor”, meaning it is passed the whole data vector in one call and you must use the single_action_visit() interface.
This functor class calculates the crossover of a data vector with two of its moving averages. It could be used to generate signals within financial applications.
The constructor takes the two adopters:
DoubleCrossOver(S_RT &&short_moving, L_RT &&long_moving)
There are 3 methods that give you the results:
- const result_type &get_raw_to_short_term() const – Returns a vector of data column minus short moving average
- const result_type &get_raw_to_long_term() const – Returns a vector of data column minus long moving average
- const result_type &get_short_term_to_long_term () const – Returns a vector of short term moving average minus long moving average
|
S_RT: A short term moving average adopter. For example, a simple moving adopter using a geometric mean
L_RT: A longer term moving average adopter. For example, an exponential moving adopter using a simple mean
T: Column data type
I: Index type
|