![]() |
algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
|
Holds quantity_ shares while the fast moving average is above the slow one, and is flat otherwise. More...
#include <algotradelib/src/strategy/vanilla/crossover.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 the target position for the instrument on each of its bars. | |
Public Attributes | |
| Params | params_ |
| The settings. | |
Holds quantity_ shares while the fast moving average is above the slow one, and is flat otherwise.
On every bar it states a target position (the level, not a crossing event), so it keeps no state and behaves the same after a restart.
Definition at line 47 of file crossover.hpp.
|
inline |
States the target position for the instrument on each of its bars.
| Ctx | The runner's context type. |
| ctx | The context. |
| bar | The new bar. |
Definition at line 80 of file crossover.hpp.
Referenced by algotradelib::strategy::vanilla::EmaCrossover::on_bar(), and algotradelib::strategy::vanilla::SmaCrossover::on_bar().
|
inline |
Returns how many bars to load before the first live bar.
Definition at line 71 of file crossover.hpp.
Referenced by on_bar(), algotradelib::strategy::vanilla::EmaCrossover::warmup_bars(), and algotradelib::strategy::vanilla::SmaCrossover::warmup_bars().
| Params algotradelib::strategy::vanilla::MovingAverageCrossover::params_ |
The settings.
Definition at line 65 of file crossover.hpp.
Referenced by on_bar(), and warmup_bars().