![]() |
algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
|
Holds a fixed quantity of one instrument. More...
#include <algotradelib/src/strategy/vanilla/buy_and_hold.hpp>
Classes | |
| struct | Params |
| The strategy's settings. More... | |
Public Member Functions | |
| template<class Ctx> | |
| void | on_bar (Ctx &ctx, const BarEvent &bar) |
| States the target position on each bar of the instrument. | |
Public Attributes | |
| Params | params_ |
| The settings. | |
Static Public Attributes | |
| static constexpr std::size_t | warmup_bars = 1 |
| One bar of history is enough. | |
Holds a fixed quantity of one instrument.
States the same target position on every bar, so it buys once and then sends nothing while the holding matches, including after a restart. Useful as a benchmark.
Definition at line 21 of file buy_and_hold.hpp.
|
inline |
States the target position on each bar of the instrument.
| Ctx | The runner's context type. |
| ctx | The context. |
| bar | The new bar. |
Definition at line 45 of file buy_and_hold.hpp.
| Params algotradelib::strategy::vanilla::BuyAndHold::params_ |
|
staticconstexpr |
One bar of history is enough.
Definition at line 36 of file buy_and_hold.hpp.