|
tzutrader
A composable C++ backtesting library for trading strategies (experimental)
|
#include <indicators.h>
Public Member Functions | |
| MACD (size_t short_period, size_t long_period, size_t signal_period, double smoothing=2.0) | |
| MACDResult | get () const noexcept |
| MACDResult | update (double value) |
| Public Member Functions inherited from tzu::Indicator< MACD, double, MACDResult > | |
| MACDResult | get () const noexcept |
| MACDResult | update (double value) |
Moving Average Convergence Divergence (MACD)
Combines multiple EMAs to calculate the MACD line, signal line, and histogram. Returns NaN for all values until enough data has been added to fill the initial periods for both EMAs. Once the initial periods are filled, it calculates the MACD line as the difference between the short-term EMA and the long-term EMA. The signal line is calculated as the EMA of the MACD line, and the histogram is the difference between the MACD line and the signal line.
|
inline |
|
inlinenoexcept |
|
inline |