PineForge unreleased
Deterministic PineScript v6 backtest runtime — C ABI reference
Loading...
Searching...
No Matches
pine_value_admit_risk.hpp
Go to the documentation of this file.
1#pragma once
2
4
6
7#include <cmath>
8
9namespace pineforge::source {
10
11// Risk statements apply live, including discarded earlier pre-roll
12// evaluations. A double NaN is the existing disabled/absent limit (D1),
13// so only infinities are invalid here. Percent flags carry no numeric value;
14// the adapter keeps its existing sticky-true behavior.
15inline void admit_pine_risk_max_drawdown(double value, bool /*percent*/) {
16 if (std::isinf(value))
19}
20
21inline void admit_pine_risk_max_intraday_loss(double value, bool /*percent*/) {
22 if (std::isinf(value))
25}
26
32
33// direction, max_cons_loss_days and max_intraday_filled_orders take int,
34// which cannot represent NaN/infinity. They need no admission and retain
35// all existing domain, cap-assignment and count-switch behavior.
36
37// Assertion of the admission invariant, immediately before a retained
38// snapshot's direct restore. Ordinary capture copies already-admitted values;
39// this release-active check also refuses a hand-built invalid retained snapshot
40// through the existing typed failure path. Check all doubles before any write.
47
48} // namespace pineforge::source
constexpr const char * risk_max_drawdown
constexpr const char * risk_max_intraday_loss
constexpr const char * risk_max_position_size
void throw_strategy_value_invalid(const char *field, StrategyValueReason reason)
The coded failure of a source-owned invalid actionable value.
void admit_pine_risk_max_drawdown(double value, bool)
void assert_admitted_pine_replay_risk_config(const PineReplayRiskConfig &snapshot)
void admit_pine_risk_max_intraday_loss(double value, bool)
void admit_pine_risk_max_position_size(double value)