OpenPine C++ API
C++ wrapper for the OpenPine Pine Script VM
Loading...
Searching...
No Matches
chart.hpp
Go to the documentation of this file.
1#pragma once
2
10
11#if (defined(_MSVC_LANG) ? _MSVC_LANG : __cplusplus) < 201703L
12#error \
13 "OpenPine C++ wrapper headers require C++17 (std::optional, std::string_view)."
14#endif
15
16#include <cstdint>
17#include <memory>
18#include <optional>
19#include <string_view>
20
21#include "ffi.hpp"
22#include "types.hpp"
25#include "visuals/graph.hpp"
27
28namespace openpine {
29
35class Chart {
36 private:
37 const ffi::Chart* p_;
38
39 public:
41 Chart(const ffi::Chart* p) : p_(p) {}
42
47 uintptr_t seriesLength() const { return ffi::chartSeriesLength(p_); }
48
54 FilledOrdersIterator filledOrdersOnBar(uintptr_t bar_index) const {
55 return FilledOrdersIterator(ffi::chartFilledOrdersOnBar(p_, bar_index));
56 }
57
64 std::optional<SeriesGraphType> type = std::nullopt) const {
65 return SeriesGraphIterator(ffi::chartSeriesGraphIterator(p_), type);
66 }
67
74 std::optional<GraphType> type = std::nullopt) const {
75 return GraphIterator(ffi::chartGraphIterator(p_), type);
76 }
77
82 BarColors asBarColors() const { return BarColors{ffi::chartBarColors(p_)}; }
83};
84
85} // namespace openpine
C++ wrapper for bar-colors visual output.
Represents bar-colors settings in a chart.
GraphIterator graphIterator(std::optional< GraphType > type=std::nullopt) const
Creates an iterator over the non-series graphs in the chart.
Definition chart.hpp:73
uintptr_t seriesLength() const
Gets the series length of the chart.
Definition chart.hpp:47
BarColors asBarColors() const
Gets the bar-colors settings for the chart.
Definition chart.hpp:82
FilledOrdersIterator filledOrdersOnBar(uintptr_t bar_index) const
Creates an iterator over filled orders on a bar (strategy order fills).
Definition chart.hpp:54
SeriesGraphIterator seriesGraphIterator(std::optional< SeriesGraphType > type=std::nullopt) const
Creates an iterator over the series graphs in the chart.
Definition chart.hpp:63
Chart(const ffi::Chart *p)
Constructs a chart wrapper around the given pointer.
Definition chart.hpp:41
Iterator over filled orders (strategy order fills) on a single bar.
Iterator over non-series graphs in a chart.
Definition graph.hpp:148
Iterator over series graphs in a chart.
C++ wrapper for iterating filled orders on a chart bar.
C++ wrappers for non-series graph visuals.
C++ wrappers for series graph visuals.
Re-exports FFI types into the openpine namespace.