![]() |
algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
|
Long-only RSI strategy: buys when the index is oversold, sells when it is overbought. More...
#include <algotradelib/src/strategy/vanilla/reversion.hpp>
Classes | |
| struct | Params |
| The strategy's settings. More... | |
Public Member Functions | |
| std::size_t | warmup_bars () const |
| Returns how many bars to load before the first live bar. | |
| template<class Ctx> | |
| void | on_bar (Ctx &ctx, const BarEvent &bar) |
| States a target position for the instrument when its signal enters or exits. | |
Public Attributes | |
| Params | params_ |
| The settings. | |
Long-only RSI strategy: buys when the index is oversold, sells when it is overbought.
Buys quantity_ when flat and Wilder's RSI (analytics::rsi) is at or below oversold_; goes flat when holding and it is at or above overbought_. The defaults 30 and 70 are Wilder's.
The index is computed over every cached close (up to the runner's series_capacity), because Wilder's smoothing depends on its seed. With about 99 closes the seed's weight falls below 0.2% for period 14.
Definition at line 122 of file reversion.hpp.
|
inline |
States a target position for the instrument when its signal enters or exits.
| Ctx | The runner's context type. |
| ctx | The context. |
| bar | The new bar. |
Definition at line 155 of file reversion.hpp.
|
inline |
Returns how many bars to load before the first live bar.
Definition at line 146 of file reversion.hpp.
Referenced by on_bar().
| Params algotradelib::strategy::vanilla::RsiThreshold::params_ |
The settings.
Definition at line 140 of file reversion.hpp.
Referenced by on_bar(), and warmup_bars().