|
PineForge unreleased
Deterministic PineScript v6 backtest runtime — C ABI reference
|
The run-specification fields pf_native_run_spec_v1 predates. More...
#include <native_c_api.h>
Data Fields | |
| uint32_t | struct_size |
| sizeof(pf_native_run_spec_ext_v1). | |
| uint32_t | version |
| PF_NATIVE_API_VERSION. | |
| uint32_t | present_mask |
| pf_native_spec_ext_mask_t bits. | |
| uint32_t | report_policy |
| pf_native_report_policy_t. | |
| uint32_t | report_open_position_at_end |
| 0/1; PF_NATIVE_REPORT_KERNEL_RECORDED only. | |
| uint32_t | price_grid |
| pf_native_price_grid_t. | |
| uint32_t | grid_rounding |
| pf_native_grid_rounding_t. | |
| uint32_t | calculation |
| pf_native_calc_trigger_t. | |
| uint32_t | max_recalculations_per_point |
| Fill-cascade bound; 0 is legal. | |
| uint32_t | open_bar_view |
| pf_native_open_bar_view_t. | |
| uint32_t | margin_sizing |
| pf_native_liquidation_sizing_t. | |
| uint32_t | margin_check |
| pf_native_liquidation_check_t. | |
| uint32_t | margin_has_maintenance_long |
| uint32_t | margin_has_maintenance_short |
| uint32_t | margin_has_min_units |
| double | margin_initial_long |
| 0 = maintenance-only side: no kernel opening requirement, host owns admission; legal only with that side's maintenance set. | |
| double | margin_initial_short |
| 0 = maintenance-only; see above. | |
| double | margin_maintenance_long |
| double | margin_maintenance_short |
| double | margin_shortfall_multiple |
| The C++ default is 1.0, not 0: a PRESENT block has every field read, so a zero-filled struct must still write it — including under a sizing policy that never scales. | |
| double | margin_min_units |
| const pf_native_subscription_v1 * | subscriptions |
| Borrowed for the call. | |
| uint32_t | subscriptions_n |
| uint32_t | reserved0 |
| uint32_t | risk_has_max_drawdown |
| 0/1. | |
| uint32_t | risk_max_drawdown_percent |
| 0/1: the value is a percent of the running equity peak, out of 100. | |
| double | risk_max_drawdown |
| Threshold; account currency unless percent. | |
| uint32_t | risk_has_max_intraday_loss |
| 0/1. | |
| uint32_t | risk_max_intraday_loss_percent |
| 0/1: percent of the day's opening equity. | |
| double | risk_max_intraday_loss |
| Threshold; account currency unless percent. | |
| uint32_t | risk_has_max_consecutive_loss_days |
| 0/1. | |
| uint32_t | risk_max_consecutive_loss_days |
| Days, when the flag is 1. | |
| uint32_t | risk_has_max_fills_per_day |
| 0/1. | |
| uint32_t | risk_max_fills_per_day |
| Applied fills, when the flag is 1. | |
| uint32_t | risk_day_basis |
| pf_native_risk_day_t. | |
| uint32_t | risk_action |
| pf_native_risk_action_t. | |
| uint32_t | intrabar_kind |
| pf_native_intrabar_kind_t. | |
| int32_t | intrabar_samples |
| Samples per script bar; LOWER_TF and SYNTHESIZED. | |
| uint32_t | intrabar_distribution |
| pf_magnifier_distribution_t. | |
| uint32_t | intrabar_volume_weighted |
| 0/1. | |
| int32_t | intrabar_volume_weighted_min_samples |
| int32_t | intrabar_volume_weighted_max_samples |
| uint32_t | intrabar_sample_eligibility |
| pf_native_sample_eligibility_t, LOWER_TF only. | |
| int32_t | intrabar_n |
Length of intrabar_bars; LOWER_TF only. | |
| const char * | intrabar_tf |
| The finer timeframe; LOWER_TF only, non-NULL. | |
| const pf_bar_t * | intrabar_bars |
| The finer feed; borrowed for the call, copied. | |
| uint32_t | slot_label_policy |
| pf_native_slot_label_t. | |
| uint32_t | feed_tolerance |
| pf_native_feed_tolerance_t bits. | |
| uint32_t | path_order |
| pf_native_path_order_t. | |
| uint32_t | abort_reporting |
| pf_native_abort_reporting_t. | |
| uint32_t | margin_equity_basis |
| pf_native_margin_equity_basis_t. | |
| uint32_t | margin_level_base |
| pf_native_margin_level_base_t. | |
| const char * | margin_liquidation_label |
| Ticket of a kernel liquidation; NULL is "". | |
| const char * | margin_liquidation_comment |
| Comment of the same; NULL is "". | |
| const char * | auxiliary_tf |
| Non-NULL feed timeframe literal. | |
| const pf_bar_t * | auxiliary_bars |
| Strictly increasing bars; copied. | |
| int32_t | auxiliary_n |
Length of auxiliary_bars. | |
| uint32_t | reserved1 |
| Must be 0. | |
| const uint32_t * | subscription_sources |
Optional, borrowed for the call: subscriptions_n entries of pf_native_series_source_t, one per row of subscriptions. | |
| uint32_t | event_retention |
| pf_native_event_retention_t. | |
| uint32_t | reserved2 |
| Must be 0. | |
| double | quantity_tolerance |
Units, finite and positive: NativeRunSpec::quantity_tolerance, two quantities within it of each other are one quantity to the settlement. | |
The run-specification fields pf_native_run_spec_v1 predates.
It is a companion to pf_native_run_spec_v1, not a second configure step: the kernel configures a host exactly once, so both halves are handed to strategy_configure_native_ext_v1 together and that call replaces strategy_configure_native_v1 for a host that needs these fields. present_mask selects the blocks that are meaningful; an absent block keeps the kernel's own default, so an all-zero mask configures exactly what strategy_configure_native_v1 would have.
Every field of NativeRunSpec that is not fixed by pf_native_run_spec_v1 now travels here, except identity, which the base spec owns, and timeframe_undetected: a C run always names both timeframes.
This struct has SIX published layouts and the runtime accepts any of them: the base layout the L13 lane first shipped (PF_NATIVE_RUN_SPEC_EXT_V1_BASE_SIZE); that layout plus L9's risk_* tail (PF_NATIVE_RUN_SPEC_EXT_V1_RISK_SIZE); that one plus N8's intrabar path, the four feed-shape and presentation policies, and the margin model's equity basis, level base and liquidation strings (PF_NATIVE_RUN_SPEC_EXT_V1_POLICY_SIZE); that one plus the auxiliary_* tail (PF_NATIVE_RUN_SPEC_EXT_V1_AUXILIARY_SIZE); that one plus the event_retention tail (PF_NATIVE_RUN_SPEC_EXT_V1_RETENTION_SIZE); and the current one, which appends the quantity_tolerance tail after them. A caller compiled against an earlier layout keeps working unchanged and simply cannot set the mask bits its struct has no fields for (PF_NATIVE_SPEC_EXT_RISK, PF_NATIVE_SPEC_EXT_INTRABAR, PF_NATIVE_SPEC_EXT_FEED_POLICY, PF_NATIVE_SPEC_EXT_AUXILIARY_FEED, PF_NATIVE_SPEC_EXT_EVENT_RETENTION, PF_NATIVE_SPEC_EXT_QUANTITY_TOLERANCE): doing so is PF_NATIVE_E_STRUCT. Any other struct_size is PF_NATIVE_E_STRUCT too. Every tail is append-only: nothing above them moved.
Definition at line 2316 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::struct_size |
sizeof(pf_native_run_spec_ext_v1).
Definition at line 2317 of file native_c_api.h.
Referenced by make_ext().
| uint32_t pf_native_run_spec_ext_v1::version |
| uint32_t pf_native_run_spec_ext_v1::present_mask |
pf_native_spec_ext_mask_t bits.
Definition at line 2319 of file native_c_api.h.
Referenced by make_ext().
| uint32_t pf_native_run_spec_ext_v1::report_policy |
Definition at line 2321 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::report_open_position_at_end |
0/1; PF_NATIVE_REPORT_KERNEL_RECORDED only.
Definition at line 2322 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::price_grid |
| uint32_t pf_native_run_spec_ext_v1::grid_rounding |
Definition at line 2325 of file native_c_api.h.
Referenced by make_ext().
| uint32_t pf_native_run_spec_ext_v1::calculation |
Definition at line 2327 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::max_recalculations_per_point |
Fill-cascade bound; 0 is legal.
Definition at line 2328 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::open_bar_view |
Definition at line 2330 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::margin_sizing |
pf_native_liquidation_sizing_t.
Definition at line 2332 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::margin_check |
pf_native_liquidation_check_t.
Definition at line 2333 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::margin_has_maintenance_long |
Definition at line 2334 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::margin_has_maintenance_short |
Definition at line 2335 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::margin_has_min_units |
Definition at line 2336 of file native_c_api.h.
| double pf_native_run_spec_ext_v1::margin_initial_long |
0 = maintenance-only side: no kernel opening requirement, host owns admission; legal only with that side's maintenance set.
Definition at line 2337 of file native_c_api.h.
| double pf_native_run_spec_ext_v1::margin_initial_short |
0 = maintenance-only; see above.
Definition at line 2341 of file native_c_api.h.
| double pf_native_run_spec_ext_v1::margin_maintenance_long |
Definition at line 2342 of file native_c_api.h.
| double pf_native_run_spec_ext_v1::margin_maintenance_short |
Definition at line 2343 of file native_c_api.h.
| double pf_native_run_spec_ext_v1::margin_shortfall_multiple |
The C++ default is 1.0, not 0: a PRESENT block has every field read, so a zero-filled struct must still write it — including under a sizing policy that never scales.
Definition at line 2344 of file native_c_api.h.
| double pf_native_run_spec_ext_v1::margin_min_units |
Definition at line 2349 of file native_c_api.h.
| const pf_native_subscription_v1* pf_native_run_spec_ext_v1::subscriptions |
Borrowed for the call.
Definition at line 2351 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::subscriptions_n |
Definition at line 2352 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::reserved0 |
Definition at line 2353 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::risk_has_max_drawdown |
0/1.
Definition at line 2360 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::risk_max_drawdown_percent |
0/1: the value is a percent of the running equity peak, out of 100.
Definition at line 2361 of file native_c_api.h.
| double pf_native_run_spec_ext_v1::risk_max_drawdown |
Threshold; account currency unless percent.
Definition at line 2363 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::risk_has_max_intraday_loss |
0/1.
Definition at line 2364 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::risk_max_intraday_loss_percent |
0/1: percent of the day's opening equity.
Definition at line 2365 of file native_c_api.h.
| double pf_native_run_spec_ext_v1::risk_max_intraday_loss |
Threshold; account currency unless percent.
Definition at line 2366 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::risk_has_max_consecutive_loss_days |
0/1.
Definition at line 2367 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::risk_max_consecutive_loss_days |
Days, when the flag is 1.
Definition at line 2368 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::risk_has_max_fills_per_day |
0/1.
Definition at line 2369 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::risk_max_fills_per_day |
Applied fills, when the flag is 1.
Definition at line 2370 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::risk_day_basis |
Definition at line 2371 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::risk_action |
Definition at line 2372 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::intrabar_kind |
Definition at line 2380 of file native_c_api.h.
| int32_t pf_native_run_spec_ext_v1::intrabar_samples |
Samples per script bar; LOWER_TF and SYNTHESIZED.
Definition at line 2381 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::intrabar_distribution |
Definition at line 2382 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::intrabar_volume_weighted |
0/1.
Definition at line 2383 of file native_c_api.h.
| int32_t pf_native_run_spec_ext_v1::intrabar_volume_weighted_min_samples |
Definition at line 2384 of file native_c_api.h.
| int32_t pf_native_run_spec_ext_v1::intrabar_volume_weighted_max_samples |
Definition at line 2385 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::intrabar_sample_eligibility |
pf_native_sample_eligibility_t, LOWER_TF only.
Definition at line 2386 of file native_c_api.h.
| int32_t pf_native_run_spec_ext_v1::intrabar_n |
Length of intrabar_bars; LOWER_TF only.
Definition at line 2387 of file native_c_api.h.
| const char* pf_native_run_spec_ext_v1::intrabar_tf |
The finer timeframe; LOWER_TF only, non-NULL.
Definition at line 2388 of file native_c_api.h.
| const pf_bar_t* pf_native_run_spec_ext_v1::intrabar_bars |
The finer feed; borrowed for the call, copied.
Definition at line 2389 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::slot_label_policy |
FEED_TOLERANT keeps the caller's own labels, and a PF_NATIVE_INTRABAR_LOWER_TF path then delivers no sub-bar: its bars are not keyed to canonical input slots.
Definition at line 2391 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::feed_tolerance |
pf_native_feed_tolerance_t bits.
Definition at line 2396 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::path_order |
Definition at line 2397 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::abort_reporting |
Definition at line 2398 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::margin_equity_basis |
pf_native_margin_equity_basis_t.
Definition at line 2400 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::margin_level_base |
pf_native_margin_level_base_t.
Definition at line 2401 of file native_c_api.h.
| const char* pf_native_run_spec_ext_v1::margin_liquidation_label |
Ticket of a kernel liquidation; NULL is "".
Definition at line 2402 of file native_c_api.h.
| const char* pf_native_run_spec_ext_v1::margin_liquidation_comment |
Comment of the same; NULL is "".
Definition at line 2403 of file native_c_api.h.
| const char* pf_native_run_spec_ext_v1::auxiliary_tf |
Non-NULL feed timeframe literal.
Definition at line 2411 of file native_c_api.h.
| const pf_bar_t* pf_native_run_spec_ext_v1::auxiliary_bars |
Strictly increasing bars; copied.
May be NULL when auxiliary_n is 0.
Definition at line 2412 of file native_c_api.h.
| int32_t pf_native_run_spec_ext_v1::auxiliary_n |
Length of auxiliary_bars.
Definition at line 2414 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::reserved1 |
Must be 0.
Definition at line 2415 of file native_c_api.h.
| const uint32_t* pf_native_run_spec_ext_v1::subscription_sources |
Optional, borrowed for the call: subscriptions_n entries of pf_native_series_source_t, one per row of subscriptions.
NULL means every series is built from the input. Meaningful only together with PF_NATIVE_SPEC_EXT_SUBSCRIPTIONS.
Definition at line 2420 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::event_retention |
Definition at line 2426 of file native_c_api.h.
| uint32_t pf_native_run_spec_ext_v1::reserved2 |
Must be 0.
Definition at line 2427 of file native_c_api.h.
| double pf_native_run_spec_ext_v1::quantity_tolerance |
Units, finite and positive: NativeRunSpec::quantity_tolerance, two quantities within it of each other are one quantity to the settlement.
Definition at line 2434 of file native_c_api.h.