PineForge v0.13.1-379-g9b50973
Deterministic PineScript v6 backtest runtime — C ABI reference
Loading...
Searching...
No Matches
pineforge::native_module Namespace Reference

Data Structures

class  Module
 The one class the macro instantiates: the host plus the module boundary. More...
 

Functions

BacktestEngineas_engine (pf_strategy_t strategy)
 
template<typename Host>
Module< Host > * as_module (pf_strategy_t strategy)
 
template<typename Host>
void note_error (pf_strategy_t strategy, const char *text)
 
template<typename Host, typename Fn>
void guarded (pf_strategy_t strategy, Fn &&fn)
 Runs fn and converts any escaping exception into presentation text.
 
Bar copy_bar (const pf_bar_t &in)
 
bool magnifier_unsupported (int bar_magnifier, int magnifier_samples, pf_magnifier_distribution_t distribution)
 A native host owns its own intrabar path through NativeRunSpec::intrabar, so the C magnifier arguments have no meaning here.
 
void publish_report (BacktestEngine *engine, pf_report_t *out)
 Fills a local report first: the caller's struct is written only once the engine has produced a complete, owned value.
 
template<typename Host>
pf_strategy_t create ()
 
void destroy (pf_strategy_t strategy)
 
template<typename Host>
void set_input (pf_strategy_t strategy, const char *key, const char *value)
 
template<typename Host>
void set_override (pf_strategy_t strategy, const char *key, const char *value)
 
template<typename Host>
void set_magnifier_volume_weighted (pf_strategy_t strategy, int on)
 
template<typename Host>
void run_batch (pf_strategy_t strategy, pf_bar_t *bars, int count, const char *input_tf, const char *script_tf, bool with_timeframes, pf_report_t *out)
 
template<typename Host>
void run_backtest (pf_strategy_t strategy, pf_bar_t *bars, int count, pf_report_t *out)
 
template<typename Host>
void run_backtest_full (pf_strategy_t strategy, pf_bar_t *bars, int count, const char *input_tf, const char *script_tf, int bar_magnifier, int magnifier_samples, pf_magnifier_distribution_t magnifier_distribution, pf_report_t *out)
 
void report_free (pf_report_t *report)
 

Function Documentation

◆ as_engine()

BacktestEngine * pineforge::native_module::as_engine ( pf_strategy_t strategy)
inline

◆ as_module()

template<typename Host>
Module< Host > * pineforge::native_module::as_module ( pf_strategy_t strategy)

Definition at line 107 of file native_module.hpp.

References as_engine().

Referenced by note_error().

◆ note_error()

template<typename Host>
void pineforge::native_module::note_error ( pf_strategy_t strategy,
const char * text )

Definition at line 112 of file native_module.hpp.

References as_module().

Referenced by guarded(), run_backtest_full(), and run_batch().

◆ guarded()

template<typename Host, typename Fn>
void pineforge::native_module::guarded ( pf_strategy_t strategy,
Fn && fn )

Runs fn and converts any escaping exception into presentation text.

C callers have no exception channel, so nothing may propagate past here.

Definition at line 119 of file native_module.hpp.

References note_error().

Referenced by set_input(), set_magnifier_volume_weighted(), and set_override().

◆ copy_bar()

◆ magnifier_unsupported()

bool pineforge::native_module::magnifier_unsupported ( int bar_magnifier,
int magnifier_samples,
pf_magnifier_distribution_t distribution )
inline

A native host owns its own intrabar path through NativeRunSpec::intrabar, so the C magnifier arguments have no meaning here.

Only the defaults are accepted; anything else is refused before the run starts.

Definition at line 144 of file native_module.hpp.

References PF_MAGNIFIER_ENDPOINTS.

Referenced by run_backtest_full().

◆ publish_report()

void pineforge::native_module::publish_report ( BacktestEngine * engine,
pf_report_t * out )
inline

Fills a local report first: the caller's struct is written only once the engine has produced a complete, owned value.

Definition at line 152 of file native_module.hpp.

References pineforge::engine_script_run_v18::BacktestEngine::fill_report().

Referenced by run_batch().

◆ create()

template<typename Host>
pf_strategy_t pineforge::native_module::create ( )

Definition at line 165 of file native_module.hpp.

References pf_abi_version().

◆ destroy()

void pineforge::native_module::destroy ( pf_strategy_t strategy)
inline

Definition at line 178 of file native_module.hpp.

References as_engine().

◆ set_input()

template<typename Host>
void pineforge::native_module::set_input ( pf_strategy_t strategy,
const char * key,
const char * value )

◆ set_override()

template<typename Host>
void pineforge::native_module::set_override ( pf_strategy_t strategy,
const char * key,
const char * value )

◆ set_magnifier_volume_weighted()

template<typename Host>
void pineforge::native_module::set_magnifier_volume_weighted ( pf_strategy_t strategy,
int on )

◆ run_batch()

template<typename Host>
void pineforge::native_module::run_batch ( pf_strategy_t strategy,
pf_bar_t * bars,
int count,
const char * input_tf,
const char * script_tf,
bool with_timeframes,
pf_report_t * out )

Definition at line 208 of file native_module.hpp.

References as_engine(), copy_bar(), note_error(), and publish_report().

Referenced by run_backtest(), and run_backtest_full().

◆ run_backtest()

template<typename Host>
void pineforge::native_module::run_backtest ( pf_strategy_t strategy,
pf_bar_t * bars,
int count,
pf_report_t * out )

Definition at line 238 of file native_module.hpp.

References run_batch().

◆ run_backtest_full()

template<typename Host>
void pineforge::native_module::run_backtest_full ( pf_strategy_t strategy,
pf_bar_t * bars,
int count,
const char * input_tf,
const char * script_tf,
int bar_magnifier,
int magnifier_samples,
pf_magnifier_distribution_t magnifier_distribution,
pf_report_t * out )

Definition at line 243 of file native_module.hpp.

References magnifier_unsupported(), note_error(), and run_batch().

◆ report_free()

void pineforge::native_module::report_free ( pf_report_t * report)
inline

Definition at line 258 of file native_module.hpp.