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

Donchian channel breakout: holds after the close breaks above the channel, exits after it breaks below. More...

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

Collaboration diagram for algotradelib::strategy::vanilla::DonchianBreakout:

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.

Detailed Description

Donchian channel breakout: holds after the close breaks above the channel, exits after it breaks below.

The channel is the highest and lowest close of the lookback_ bars before the latest one. A close above the channel states a target of quantity_; a close below it, a target of zero.

Definition at line 206 of file reversion.hpp.

Member Function Documentation

◆ on_bar()

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

States a target position for the instrument when its signal enters or exits.

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

Definition at line 235 of file reversion.hpp.

◆ warmup_bars()

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

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

Returns
lookback_ + 1.

Definition at line 226 of file reversion.hpp.

Member Data Documentation

◆ params_

Params algotradelib::strategy::vanilla::DonchianBreakout::params_

The settings.

Definition at line 220 of file reversion.hpp.

Referenced by on_bar(), and warmup_bars().


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