|
PineForge v0.10.12
Deterministic PineScript v6 backtest runtime — C ABI reference
|
Closed-trade record returned in pf_report_t::trades. More...
#include <pineforge.h>
Data Fields | |
| int64_t | entry_time |
| Entry fill time (Unix ms). | |
| int64_t | exit_time |
| Exit fill time (Unix ms). | |
| double | entry_price |
| Entry fill price (incl. | |
| double | exit_price |
| Exit fill price (incl. | |
| double | pnl |
| Net realized PnL in account currency (commission-inclusive). | |
| double | pnl_pct |
| Net return-on-cost in percent: pnl (NET of commission) / entry cost (entry_price * qty * pointvalue) * 100. | |
| int | is_long |
| 1 if long, 0 if short. | |
| double | max_runup |
| Peak favorable price travel during the trade ($/unit qty). | |
| double | max_drawdown |
| Peak adverse price travel during the trade ($/unit qty). | |
| double | qty |
| Filled quantity. | |
| double | commission |
| Entry+exit commission actually deducted from pnl (account currency). | |
| int32_t | entry_bar_index |
| Script-bar index of the entry fill (0-based). | |
| int32_t | exit_bar_index |
| Script-bar index of the exit fill (0-based). | |
Closed-trade record returned in pf_report_t::trades.
Layout-compatible with internal pineforge::TradeC.
Definition at line 119 of file pineforge.h.
| int64_t pf_trade_t::entry_time |
Entry fill time (Unix ms).
Definition at line 120 of file pineforge.h.
| int64_t pf_trade_t::exit_time |
Exit fill time (Unix ms).
Definition at line 121 of file pineforge.h.
| double pf_trade_t::entry_price |
| double pf_trade_t::exit_price |
| double pf_trade_t::pnl |
Net realized PnL in account currency (commission-inclusive).
Definition at line 124 of file pineforge.h.
| double pf_trade_t::pnl_pct |
Net return-on-cost in percent: pnl (NET of commission) / entry cost (entry_price * qty * pointvalue) * 100.
This is TradingView's "Net P&L %" convention, arbitrated 2026-06-12 against a real TV export (trade #258 short: 102.44 USD on a 2276.66 entry => 4.50%). Degenerates to the old gross (exit/entry-1)*100 form for longs with zero commission; the previous short form (entry/exit-1)*100 was wrong on large moves. Sign always matches pnl.
Definition at line 125 of file pineforge.h.
| int pf_trade_t::is_long |
1 if long, 0 if short.
Definition at line 133 of file pineforge.h.
| double pf_trade_t::max_runup |
Peak favorable price travel during the trade ($/unit qty).
Definition at line 134 of file pineforge.h.
| double pf_trade_t::max_drawdown |
Peak adverse price travel during the trade ($/unit qty).
Definition at line 135 of file pineforge.h.
| double pf_trade_t::qty |
Filled quantity.
Definition at line 136 of file pineforge.h.
| double pf_trade_t::commission |
Entry+exit commission actually deducted from pnl (account currency).
pnl is already net of this.
Definition at line 137 of file pineforge.h.
| int32_t pf_trade_t::entry_bar_index |
Script-bar index of the entry fill (0-based).
Definition at line 139 of file pineforge.h.
| int32_t pf_trade_t::exit_bar_index |
Script-bar index of the exit fill (0-based).
Definition at line 140 of file pineforge.h.