PineForge
v1.4.0-4-g873b25da
Deterministic PineScript v6 backtest runtime — C ABI reference
Loading...
Searching...
No Matches
callback_lifecycle_rules.hpp
Go to the documentation of this file.
1
#pragma once
2
// Per-rule switches for the callback and lifecycle pins (TradingView
3
// synthetic tapes, tests/fixtures/callback_lifecycle). Every switch is ON
4
// in the shipped library. They exist so a regression can be bisected one
5
// rule at a time: only tests clear them (test_callback_lifecycle_tapes
6
// clears each in turn and requires exactly its tapes to depart), through this
7
// internal header; no public API, C ABI entry or strategy input reaches them.
8
// A switch is read when its rule applies and never stored, so it holds no run
9
// state. Process-wide: set one only around single-threaded runs. Not part of
10
// the installed API.
11
12
namespace
pineforge::source::detail
{
13
14
enum class
PineCallbackLifecycleRule
:
int
{
15
// trail_points become whole ticks with a mintick-scaled tolerance,
16
// ceil(trail_points - c * mintick), instead of the constant 5e-5 ticks
17
// (compat::pine::trail_points_to_ticks).
18
TrailPointsMintickTolerance
= 0,
19
// A declined reversal kills the held position's stop and limit exits; a
20
// later re-issue of such an exit, changed or not, is a new live order.
21
// Without the switch an unchanged re-issue keeps the killed row
22
// (reissue_revives_declined_exit).
23
DeclinedReversalReissueRevives
= 1,
24
// A limit exit born in a calc_on_order_fills recalculation reaches the
25
// end of its in-flight leg only when that waypoint's tick-built print
26
// does; the level itself stays raw (exit()'s in-flight remainder).
27
CallbackLimitTickReach
= 2,
28
// A limit exit under calc_on_order_fills that closes the position held
29
// when it is placed, on the chart path, and that its placement point does
30
// not already reach, rests at its half-tick threshold: a print half a
31
// tick short of an on-grid level reaches it (H 9.725 prints 9.73 and
32
// fills a 9.73 sell limit). Without the switch every on-grid level stays
33
// raw under calc_on_order_fills (exit_limit_trigger).
34
RestingLimitTickReach
= 3,
35
// A carried trailing stop (calc_on_order_fills off) is reached at the
36
// first point where the bar's tick-built print reaches it, when that comes
37
// before the raw print would; the level stays the raw running best +/- the
38
// offset (retune_carried_trails_for_tick_reach).
39
CarriedTrailTickReach
= 4,
40
};
41
42
inline
constexpr
int
kPineCallbackLifecycleRuleCount
= 5;
43
44
void
set_pine_callback_lifecycle_rule
(
PineCallbackLifecycleRule
rule,
bool
on)
noexcept
;
45
bool
pine_callback_lifecycle_rule
(
PineCallbackLifecycleRule
rule)
noexcept
;
46
47
}
// namespace pineforge::source::detail
pineforge::source::detail
Definition
pine_adapter.hpp:393
pineforge::source::detail::PineCallbackLifecycleRule
PineCallbackLifecycleRule
Definition
callback_lifecycle_rules.hpp:14
pineforge::source::detail::PineCallbackLifecycleRule::DeclinedReversalReissueRevives
@ DeclinedReversalReissueRevives
Definition
callback_lifecycle_rules.hpp:23
pineforge::source::detail::PineCallbackLifecycleRule::CarriedTrailTickReach
@ CarriedTrailTickReach
Definition
callback_lifecycle_rules.hpp:39
pineforge::source::detail::PineCallbackLifecycleRule::TrailPointsMintickTolerance
@ TrailPointsMintickTolerance
Definition
callback_lifecycle_rules.hpp:18
pineforge::source::detail::PineCallbackLifecycleRule::RestingLimitTickReach
@ RestingLimitTickReach
Definition
callback_lifecycle_rules.hpp:34
pineforge::source::detail::PineCallbackLifecycleRule::CallbackLimitTickReach
@ CallbackLimitTickReach
Definition
callback_lifecycle_rules.hpp:27
pineforge::source::detail::pine_callback_lifecycle_rule
bool pine_callback_lifecycle_rule(PineCallbackLifecycleRule rule) noexcept
Definition
pine_adapter.cpp:697
pineforge::source::detail::kPineCallbackLifecycleRuleCount
constexpr int kPineCallbackLifecycleRuleCount
Definition
callback_lifecycle_rules.hpp:42
pineforge::source::detail::set_pine_callback_lifecycle_rule
void set_pine_callback_lifecycle_rule(PineCallbackLifecycleRule rule, bool on) noexcept
Definition
pine_adapter.cpp:692
src
compat
pine
callback_lifecycle_rules.hpp
PineForge v1.4.0-4-g873b25da — Apache-2.0 —
github.com/pineforge-4pass/pineforge-engine