PineForge v0.10.1-13-gd771a78
Deterministic PineScript v6 backtest runtime — C ABI reference
Loading...
Searching...
No Matches
pf_equity_stats_t Struct Reference

Equity-curve-derived statistics (all-trades only, like TV). More...

#include <pineforge.h>

Data Fields

double max_equity_drawdown
 Peak-to-trough equity drop, positive currency magnitude.
 
double max_equity_drawdown_pct
 max_equity_drawdown relative to the peak in effect (PERCENT 0-100).
 
double max_equity_runup
 Trough-to-peak rise where the trough resets on each new equity peak (mirrors the engine's intra-run extremes).
 
double max_equity_runup_pct
 max_equity_runup relative to that trough (PERCENT 0-100).
 
double buy_hold_return
 initial_capital * (last_close/first_open - 1), currency.
 
double buy_hold_return_pct
 buy_hold_return as PERCENT.
 
double sharpe_tv
 Month-end-resampled equity simple returns (chart timezone, open-time bucketing), risk-free 2%/yr (2/12 per month), annualized by sqrt(12).
 
double sortino_tv
 Same resampling as sharpe_tv; uses population downside deviation vs the monthly risk-free.
 
double sharpe_bar
 Per-script-bar returns, annualized by observed bar density (bars per year = (len-1)/calendar span), NOT a fixed calendar formula.
 
double sortino_bar
 Same construction as sharpe_bar over per-bar returns; uses population downside deviation.
 
double cagr
 PERCENT per year: 100*((final_equity/initial_capital)^(1/years)-1).
 
double calmar
 cagr / max_equity_drawdown_pct — BOTH IN PERCENT, so the ratio is dimensionless.
 
double recovery_factor
 net_profit / max_equity_drawdown (currency / currency).
 
double time_in_market_pct
 PERCENT (0-100) of script bars with an open position at bar close.
 
double open_pl
 Mark-to-market open profit at the final bar.
 

Detailed Description

Equity-curve-derived statistics (all-trades only, like TV).

Definition at line 210 of file pineforge.h.

Field Documentation

◆ max_equity_drawdown

double pf_equity_stats_t::max_equity_drawdown

Peak-to-trough equity drop, positive currency magnitude.

Definition at line 211 of file pineforge.h.

◆ max_equity_drawdown_pct

double pf_equity_stats_t::max_equity_drawdown_pct

max_equity_drawdown relative to the peak in effect (PERCENT 0-100).

Definition at line 212 of file pineforge.h.

◆ max_equity_runup

double pf_equity_stats_t::max_equity_runup

Trough-to-peak rise where the trough resets on each new equity peak (mirrors the engine's intra-run extremes).

Definition at line 214 of file pineforge.h.

◆ max_equity_runup_pct

double pf_equity_stats_t::max_equity_runup_pct

max_equity_runup relative to that trough (PERCENT 0-100).

Definition at line 216 of file pineforge.h.

◆ buy_hold_return

double pf_equity_stats_t::buy_hold_return

initial_capital * (last_close/first_open - 1), currency.

NaN when first chart open is non-finite or <= 0.

Definition at line 217 of file pineforge.h.

◆ buy_hold_return_pct

double pf_equity_stats_t::buy_hold_return_pct

buy_hold_return as PERCENT.

NaN when first chart open is non-finite or <= 0.

Definition at line 219 of file pineforge.h.

◆ sharpe_tv

double pf_equity_stats_t::sharpe_tv

Month-end-resampled equity simple returns (chart timezone, open-time bucketing), risk-free 2%/yr (2/12 per month), annualized by sqrt(12).

Uses sample (N-1) stddev. NaN with <2 monthly returns or zero deviation.

Definition at line 221 of file pineforge.h.

◆ sortino_tv

double pf_equity_stats_t::sortino_tv

Same resampling as sharpe_tv; uses population downside deviation vs the monthly risk-free.

NaN with <2 monthly returns or zero deviation.

Definition at line 225 of file pineforge.h.

◆ sharpe_bar

double pf_equity_stats_t::sharpe_bar

Per-script-bar returns, annualized by observed bar density (bars per year = (len-1)/calendar span), NOT a fixed calendar formula.

Uses sample (N-1) stddev. NaN with <2 returns or zero deviation.

Definition at line 228 of file pineforge.h.

◆ sortino_bar

double pf_equity_stats_t::sortino_bar

Same construction as sharpe_bar over per-bar returns; uses population downside deviation.

NaN with <2 returns or zero deviation.

Definition at line 232 of file pineforge.h.

◆ cagr

double pf_equity_stats_t::cagr

PERCENT per year: 100*((final_equity/initial_capital)^(1/years)-1).

NaN when span <= 0 or either side <= 0.

Definition at line 235 of file pineforge.h.

◆ calmar

double pf_equity_stats_t::calmar

cagr / max_equity_drawdown_pct — BOTH IN PERCENT, so the ratio is dimensionless.

NaN when drawdown is 0.

Definition at line 237 of file pineforge.h.

◆ recovery_factor

double pf_equity_stats_t::recovery_factor

net_profit / max_equity_drawdown (currency / currency).

NaN when drawdown is 0.

Definition at line 239 of file pineforge.h.

◆ time_in_market_pct

double pf_equity_stats_t::time_in_market_pct

PERCENT (0-100) of script bars with an open position at bar close.

Definition at line 241 of file pineforge.h.

◆ open_pl

double pf_equity_stats_t::open_pl

Mark-to-market open profit at the final bar.

Definition at line 243 of file pineforge.h.


The documentation for this struct was generated from the following file: