tzutrader
A composable C++ backtesting library for trading strategies (experimental)
Loading...
Searching...
No Matches
tzu::SMACrossover Class Reference

#include <strategies.h>

Inheritance diagram for tzu::SMACrossover:
tzu::Strategy< SMACrossover, SingleValue >

Public Member Functions

 SMACrossover (size_t short_period, size_t long_period, double threshold=0.0)
Signal update (const SingleValue &data)
Public Member Functions inherited from tzu::Strategy< SMACrossover, SingleValue >
Signal update (const SingleValue &data)

Detailed Description

The cross-over strategy using two Simple Moving Averages (SMA). Generates a buy signal when the short SMA crosses above the long SMA, and a sell signal when the short SMA crosses below the long SMA. The threshold parameter allows for a percentage-based buffer to avoid false signals in choppy markets.

Constructor & Destructor Documentation

◆ SMACrossover()

tzu::SMACrossover::SMACrossover ( size_t short_period,
size_t long_period,
double threshold = 0.0 )
inline

Member Function Documentation

◆ update()

Signal tzu::SMACrossover::update ( const SingleValue & data)
inline

The documentation for this class was generated from the following file: