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

MovingAverageCrossover with exponential averages. More...

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

Collaboration diagram for algotradelib::strategy::vanilla::EmaCrossover:

Public Member Functions

 EmaCrossover (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 EXPONENTIAL.

Detailed Description

MovingAverageCrossover with exponential averages.

Definition at line 156 of file crossover.hpp.

Constructor & Destructor Documentation

◆ EmaCrossover()

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

Constructs the strategy.

Parameters
paramsThe settings; kind_ is overridden with EXPONENTIAL.

Definition at line 164 of file crossover.hpp.

Member Function Documentation

◆ on_bar()

template<class Ctx>
void algotradelib::strategy::vanilla::EmaCrossover::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 179 of file crossover.hpp.

◆ warmup_bars()

std::size_t algotradelib::strategy::vanilla::EmaCrossover::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 170 of file crossover.hpp.

Member Data Documentation

◆ inner_

MovingAverageCrossover algotradelib::strategy::vanilla::EmaCrossover::inner_

The general crossover, with kind_ set to EXPONENTIAL.

Definition at line 158 of file crossover.hpp.

Referenced by on_bar(), and warmup_bars().


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