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

The last two values of an indicator line, for testing a crossing. More...

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

Public Member Functions

bool rose_above (const Crossing &other) const
 Tests whether this line crossed above another on the latest bar.
bool fell_below (const Crossing &other) const
 Tests whether this line crossed below another on the latest bar.

Public Attributes

math::Scalar previous_ {0}
 The value on the previous bar.
math::Scalar current_ {0}
 The value on the latest bar.

Detailed Description

The last two values of an indicator line, for testing a crossing.

Definition at line 21 of file signal.hpp.

Member Function Documentation

◆ fell_below()

bool algotradelib::strategy::vanilla::Crossing::fell_below ( const Crossing & other) const
inline

Tests whether this line crossed below another on the latest bar.

Parameters
otherThe other line's last two values.
Returns
true if this line was at or above other before and is below it now.

Definition at line 41 of file signal.hpp.

◆ rose_above()

bool algotradelib::strategy::vanilla::Crossing::rose_above ( const Crossing & other) const
inline

Tests whether this line crossed above another on the latest bar.

Parameters
otherThe other line's last two values.
Returns
true if this line was at or below other before and is above it now.

Definition at line 32 of file signal.hpp.

Member Data Documentation

◆ current_

math::Scalar algotradelib::strategy::vanilla::Crossing::current_ {0}

The value on the latest bar.

Definition at line 25 of file signal.hpp.

Referenced by fell_below(), algotradelib::strategy::vanilla::last_two(), and rose_above().

◆ previous_

math::Scalar algotradelib::strategy::vanilla::Crossing::previous_ {0}

The value on the previous bar.

Definition at line 23 of file signal.hpp.

Referenced by fell_below(), algotradelib::strategy::vanilla::last_two(), and rose_above().


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