PineForge v0.2.0-1-gb2f747d
Deterministic PineScript v6 backtest runtime — C ABI reference
Loading...
Searching...
No Matches
pineforge.h File Reference
#include <stdint.h>
#include <stddef.h>
#include <pineforge/version.h>
Include dependency graph for pineforge.h:

Go to the source code of this file.

Data Structures

struct  pf_bar_t
 Single OHLCV bar pushed into the engine. More...
 
struct  pf_trade_t
 Closed-trade record returned in pf_report_t::trades. More...
 
struct  pf_security_diag_t
 Per-request.security() site diagnostic counters. More...
 
struct  pf_trace_entry_t
 Single per-bar trace entry. More...
 
struct  pf_report_t
 Backtest report filled by run_backtest / run_backtest_full. More...
 
struct  pf_version_t
 Runtime version descriptor returned by pf_version_get. More...
 

Macros

#define PF_API
 

Typedefs

typedef void * pf_strategy_t
 Opaque handle to a compiled strategy instance.
 

Enumerations

enum  pf_magnifier_distribution_t {
  PF_MAGNIFIER_UNIFORM = 0 ,
  PF_MAGNIFIER_COSINE = 1 ,
  PF_MAGNIFIER_TRIANGLE = 2 ,
  PF_MAGNIFIER_ENDPOINTS = 3 ,
  PF_MAGNIFIER_FRONT_LOADED = 4 ,
  PF_MAGNIFIER_BACK_LOADED = 5
}
 Bar-magnifier sub-bar sampling distribution. 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.
 
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.
 
pf_version_t pf_version_get (void)
 
const char * pf_version_string (void)
 Full git-derived version descriptor.
 

Macro Definition Documentation

◆ PF_API

Typedef Documentation

◆ pf_strategy_t

typedef void* pf_strategy_t

Opaque handle to a compiled strategy instance.

Definition at line 194 of file pineforge.h.