|
PineForge v0.13.1-379-g9b50973
Deterministic PineScript v6 backtest runtime — C ABI reference
|
Generic account risk limits (L9), entirely opt-in: a spec that leaves NativeRunSpec::risk unset evaluates nothing, appends no event and folds nothing into the continuation digest.
More...
#include <native_run_spec.hpp>
Data Fields | |
| std::optional< NativeLossLimit > | max_drawdown |
| std::optional< NativeLossLimit > | max_intraday_loss |
| std::optional< std::uint32_t > | max_consecutive_loss_days |
| std::optional< std::uint32_t > | max_fills_per_day |
| NativeRiskDay | day_basis = NativeRiskDay::SessionDay |
| NativeRiskAction | action = NativeRiskAction::BlockOpenings |
Generic account risk limits (L9), entirely opt-in: a spec that leaves NativeRunSpec::risk unset evaluates nothing, appends no event and folds nothing into the continuation digest.
The existing per-opening caps (max_abs_units, max_open_lots, allowed_open_directions) are unchanged and independent of this block.
Every limit is measured at three points of each script bar — its open, its own close calculation, and after each applied drain — against the marked equity there: max_drawdown equity has fallen from its running peak by at least the limit (percent: of that peak) max_intraday_loss equity is below the day's opening equity by at least the limit (percent: of that opening equity) max_consecutive_loss_days N consecutive days each closing with a realized loss; a day that closes with a realized profit restarts the count, a day with no realized result leaves it where it was max_fills_per_day N applied fills within the day, counted as they settle, so the fills of one matching point all settle and the limit blocks the next admission
A drawdown or consecutive-loss-days breach blocks openings to the end of the run; the two intraday limits block to the end of their own day. TradingView's own strategy.risk.* rules are not this model: its chart-day key, its cancel-pending behaviour and its epsilon stay in the source layer, which never sets this block.
Definition at line 309 of file native_run_spec.hpp.
| std::optional<NativeLossLimit> pineforge::native_run_spec_v3::NativeRiskLimits::max_drawdown |
Definition at line 310 of file native_run_spec.hpp.
| std::optional<NativeLossLimit> pineforge::native_run_spec_v3::NativeRiskLimits::max_intraday_loss |
Definition at line 311 of file native_run_spec.hpp.
| std::optional<std::uint32_t> pineforge::native_run_spec_v3::NativeRiskLimits::max_consecutive_loss_days |
Definition at line 312 of file native_run_spec.hpp.
| std::optional<std::uint32_t> pineforge::native_run_spec_v3::NativeRiskLimits::max_fills_per_day |
Definition at line 313 of file native_run_spec.hpp.
| NativeRiskDay pineforge::native_run_spec_v3::NativeRiskLimits::day_basis = NativeRiskDay::SessionDay |
Definition at line 314 of file native_run_spec.hpp.
| NativeRiskAction pineforge::native_run_spec_v3::NativeRiskLimits::action = NativeRiskAction::BlockOpenings |
Definition at line 315 of file native_run_spec.hpp.