PineForge v0.13.1-379-g9b50973
Deterministic PineScript v6 backtest runtime — C ABI reference
Loading...
Searching...
No Matches
pineforge::native_run_spec_v3::NativeRiskLimits Struct 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< NativeLossLimitmax_drawdown
 
std::optional< NativeLossLimitmax_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
 

Detailed Description

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.

Field Documentation

◆ max_drawdown

std::optional<NativeLossLimit> pineforge::native_run_spec_v3::NativeRiskLimits::max_drawdown

Definition at line 310 of file native_run_spec.hpp.

◆ max_intraday_loss

std::optional<NativeLossLimit> pineforge::native_run_spec_v3::NativeRiskLimits::max_intraday_loss

Definition at line 311 of file native_run_spec.hpp.

◆ max_consecutive_loss_days

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.

◆ max_fills_per_day

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.

◆ day_basis

NativeRiskDay pineforge::native_run_spec_v3::NativeRiskLimits::day_basis = NativeRiskDay::SessionDay

Definition at line 314 of file native_run_spec.hpp.

◆ action

NativeRiskAction pineforge::native_run_spec_v3::NativeRiskLimits::action = NativeRiskAction::BlockOpenings

Definition at line 315 of file native_run_spec.hpp.


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