|
PineForge v0.1.2-11-ga87241d
Deterministic PineScript v6 backtest runtime — C ABI reference
|
Create, run, and destroy a compiled strategy instance. More...
Functions | |
| pf_strategy_t | strategy_create (const char *params_json) |
| Allocate a new strategy instance. | |
| void | strategy_free (pf_strategy_t s) |
| Release a strategy handle previously returned by strategy_create. | |
| void | run_backtest (pf_strategy_t s, pf_bar_t *bars, int n, pf_report_t *out) |
| Run a backtest with auto-detected timeframe and no bar magnifier. | |
| void | run_backtest_full (pf_strategy_t s, pf_bar_t *bars, int n, const char *input_tf, const char *script_tf, int bar_magnifier, int magnifier_samples, pf_magnifier_distribution_t magnifier_dist, pf_report_t *out) |
| Run a backtest with explicit timeframe and magnifier configuration. | |
| void | report_free (pf_report_t *report) |
| Free heap arrays attached to a filled report. | |
Create, run, and destroy a compiled strategy instance.
| pf_strategy_t strategy_create | ( | const char * | params_json | ) |
Allocate a new strategy instance.
| params_json | Currently ignored; pass NULL. |
NULL on allocation failure.Caller owns the returned handle and must release it via strategy_free.
References PF_API.
| void strategy_free | ( | pf_strategy_t | s | ) |
Release a strategy handle previously returned by strategy_create.
Safe to call with NULL. Invalidates any pf_report_t::trace_names pointers obtained from this strategy.
References PF_API.
| void run_backtest | ( | pf_strategy_t | s, |
| pf_bar_t * | bars, | ||
| int | n, | ||
| pf_report_t * | out ) |
Run a backtest with auto-detected timeframe and no bar magnifier.
| s | Strategy handle from strategy_create. |
| bars | Non-NULL pointer to OHLCV bars (length n). |
| n | Bar count (>= 0). |
| out | Non-NULL output report. Fields are populated with heap allocations the caller must release via report_free. |
References PF_API.
| void run_backtest_full | ( | pf_strategy_t | s, |
| pf_bar_t * | bars, | ||
| int | n, | ||
| const char * | input_tf, | ||
| const char * | script_tf, | ||
| int | bar_magnifier, | ||
| int | magnifier_samples, | ||
| pf_magnifier_distribution_t | magnifier_dist, | ||
| pf_report_t * | out ) |
Run a backtest with explicit timeframe and magnifier configuration.
| s | Strategy handle. |
| bars | Bar feed. |
| n | Bar count. |
| input_tf | Input timeframe ("1", "5", "15", "60", "1D", ...). Empty string → auto-detect from bar timestamps. |
| script_tf | Script timeframe. Empty string → defaults to input_tf. |
| bar_magnifier | Boolean (0 / non-zero) — enable bar magnifier. |
| magnifier_samples | Sub-bar samples per parent bar (typical: 4). |
| magnifier_dist | Sampling distribution (see pf_magnifier_distribution_t). |
| out | Output report. Free with report_free. |
References PF_API.
| void report_free | ( | pf_report_t * | report | ) |
Free heap arrays attached to a filled report.
Idempotent. Safe to call with NULL or an already-freed report. The pf_report_t struct itself is caller-owned.
References PF_API.