PineForge v0.2.0-1-gb2f747d
Deterministic PineScript v6 backtest runtime — C ABI reference
Loading...
Searching...
No Matches
Per-strategy configuration

Override input. More...

Functions

void strategy_set_input (pf_strategy_t s, const char *key, const char *value)
 Override a Pine input.
 
void strategy_set_override (pf_strategy_t s, const char *key, const char *value)
 Override a strategy(...) declaration parameter.
 
void strategy_set_magnifier_volume_weighted (pf_strategy_t s, int on)
 Toggle volume-weighted bar-magnifier sampling.
 
void strategy_set_trace_enabled (pf_strategy_t s, int on)
 Toggle per-bar trace recording.
 
void strategy_set_trade_start_time (pf_strategy_t s, int64_t timestamp_ms)
 Set the earliest Unix-ms timestamp at which strategy order commands may fire.
 
const char * strategy_get_last_error (pf_strategy_t s)
 Returns the error message captured by the most recent run_backtest / run_backtest_full call on this strategy.
 

Detailed Description

Override input.

*() values, strategy(...) params, and runtime knobs.

Function Documentation

◆ strategy_set_input()

void strategy_set_input ( pf_strategy_t s,
const char * key,
const char * value )

Override a Pine input.

*() value before the next run.

Parameters
sStrategy handle.
keyThe input's title (or fallback identifier).
valueSerialized value — numbers as decimal strings, booleans as "true" / "false".

Calls after run_backtest are accepted but only take effect on subsequent runs.

References PF_API.

◆ strategy_set_override()

void strategy_set_override ( pf_strategy_t s,
const char * key,
const char * value )

Override a strategy(...) declaration parameter.

Recognised key values: initial_capital, commission_value, default_qty_value, pyramiding, slippage, process_orders_on_close, close_entries_rule, default_qty_type, commission_type.

References PF_API.

◆ strategy_set_magnifier_volume_weighted()

void strategy_set_magnifier_volume_weighted ( pf_strategy_t s,
int on )

Toggle volume-weighted bar-magnifier sampling.

Has no effect unless the bar magnifier is enabled in run_backtest_full.

References PF_API.

◆ strategy_set_trace_enabled()

void strategy_set_trace_enabled ( pf_strategy_t s,
int on )

Toggle per-bar trace recording.

Default off (zero-cost when off).

Enables capture for // @pf-trace name=expr pragmas already compiled into the strategy .so. Trace records appear in pf_report_t::trace.

References PF_API.

◆ strategy_set_trade_start_time()

void strategy_set_trade_start_time ( pf_strategy_t s,
int64_t timestamp_ms )

Set the earliest Unix-ms timestamp at which strategy order commands may fire.

Earlier bars still execute user code and warm TA/series state, but strategy.entry/order/exit/close commands are ignored.

References PF_API.

◆ strategy_get_last_error()

const char * strategy_get_last_error ( pf_strategy_t s)

Returns the error message captured by the most recent run_backtest / run_backtest_full call on this strategy.

Returns an empty string when the run completed normally, or NULL only when s itself is NULL. The pointer is owned by the engine and remains valid until the next run_backtest* call (which clears the captured error before it begins).

The runtime catches every std::exception derivative inside the engine's run loop so the C ABI never unwinds a C++ exception across the extern "C" boundary. Consumers must check this after every run to surface engine-rejected configurations such as a script timeframe finer than the input timeframe, a request.security timeframe below the chart timeframe without a supported lower-TF emulation, or a missing input timeframe when securities are registered.

References PF_API.