|
tzutrader
A composable C++ backtesting library for trading strategies (experimental)
|
Simple Moving Average (SMA). More...
#include <indicators.h>
Public Member Functions | |
| SMA (size_t window_size) | |
| double | get () const noexcept |
| double | update (double value) |
| Public Member Functions inherited from tzu::Indicator< SMA, double, double > | |
| double | get () const noexcept |
| double | update (double value) |
Simple Moving Average (SMA).
Maintains a fixed-size window of the most recent values and calculates the average. Returns NaN until enough values have been added to fill the window. Once the window is full, it updates the average efficiently by keeping a running sum and subtracting the value that falls out of the window.
|
inline |
|
inlinenoexcept |
|
inline |