algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
Loading...
Searching...
No Matches
algotradelib::strategy::vanilla::SmaCrossover Struct Reference

MovingAverageCrossover with simple averages. More...

#include <algotradelib/src/strategy/vanilla/crossover.hpp>

Collaboration diagram for algotradelib::strategy::vanilla::SmaCrossover:

Public Member Functions

 SmaCrossover (MovingAverageCrossover::Params params={})
 Constructs the strategy.
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)
 Calls the general crossover's on_bar.

Public Attributes

MovingAverageCrossover inner_
 The general crossover, with kind_ set to SIMPLE.

Detailed Description

MovingAverageCrossover with simple averages.

Definition at line 127 of file crossover.hpp.

Constructor & Destructor Documentation

◆ SmaCrossover()

algotradelib::strategy::vanilla::SmaCrossover::SmaCrossover ( MovingAverageCrossover::Params params = {})
inlineexplicit

Constructs the strategy.

Parameters
paramsThe settings; kind_ is overridden with SIMPLE.

Definition at line 135 of file crossover.hpp.

Member Function Documentation

◆ on_bar()

template<class Ctx>
void algotradelib::strategy::vanilla::SmaCrossover::on_bar ( Ctx & ctx,
const BarEvent & bar )
inline

Calls the general crossover's on_bar.

Template Parameters
CtxThe runner's context type.
Parameters
ctxThe context.
barThe new bar.

Definition at line 150 of file crossover.hpp.

◆ warmup_bars()

std::size_t algotradelib::strategy::vanilla::SmaCrossover::warmup_bars ( ) const
inline

Returns how many bars to load before the first live bar.

Returns
slow_ + 1; the strategy acts only once that many closes are cached.

Definition at line 141 of file crossover.hpp.

Member Data Documentation

◆ inner_

MovingAverageCrossover algotradelib::strategy::vanilla::SmaCrossover::inner_

The general crossover, with kind_ set to SIMPLE.

Definition at line 129 of file crossover.hpp.

Referenced by on_bar(), and warmup_bars().


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