Sumitx369/Paper_Trading_Backtesting
2
1#pragma once2#include <vector>3 4namespace ind {5 6using Vec = std::vector<double>;7 8// All functions return a series the same length as the input, with a9// quiet_NaN "warm-up" prefix where the indicator is not yet defined.10// NaN-handling note: the EMA helpers tolerate a leading run of NaNs in the11// input (used to chain MACD signal off the MACD line).12 13Vec sma(const Vec& x, int n);14Vec ema(const Vec& x, int n);15Vec rsi(const Vec& close, int n);16Vec rolling_std(const Vec& x, int n); // population std over the window17 18Vec bb_mid(const Vec& close, int n);19Vec bb_upper(const Vec& close, int n, double k);20Vec bb_lower(const Vec& close, int n, double k);21 22// MACD line / signal / histogram filled by reference.23void macd(const Vec& close, int fast, int slow, int signal,24 Vec& line, Vec& sig, Vec& hist);25 26Vec atr(const Vec& high, const Vec& low, const Vec& close, int n);27 28} // namespace ind29 