templat<typename T, typename I = unsigned long, typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
struct BollingerBand;
|
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 Bollinger bands and generates the spread between
the given column and lower/upper bands. It could be used to generate signals within financial applications.
The constructor takes:
- Upper band multiplier to be multiplied by standard-deviation and added to the moving average
- Lower band multiplier to be multiplied by standard-deviation and subtracted from the moving average
- Number of periods for a simple moving mean and std.
- Biased; whether the moving std is biased. The default is false meaning the denominator is “n – 1”.
BollingerBand(double upper_band_multiplier,
double lower_band_multiplier,
size_type moving_mean_period,
bool biased = false)
There are 2 methods that give you the results:
- const result_type &get_upper_band_to_raw() const – Returns a vector of upper band minus data column.
- const result_type &get_raw_to_lower_band() const – Returns a vector of data column minus lower band.
|
T: Column data type
I: Index type
|