You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit af4c688
Browse filesBrowse the repository at this point in the historyBrowse files
| 📖 **[cdocs.pineforge.dev](https://cdocs.pineforge.dev)**| Full C ABI reference, lifecycle, report schema, configuration knobs, magnifier, FFI bindings, ABI stability contract |
| 🧪 **[Tutorial: MACD on BTC/USDT](https://cdocs.pineforge.dev/tutorial_macd.html)**| End-to-end annotated walkthrough |
172
+
| 📡 **[Historical → realtime streaming](https://cdocs.pineforge.dev/streaming.html)**| Preserve strategy and broker state while switching from OHLCV to ordered trades |
170
173
| 📊 **[Trading metrics reference](https://cdocs.pineforge.dev/metrics.html)**| Every report metric (ABI v2): definitions, units, NaN rules, TV / quant-library validation status |
| Strategy orders | Supported |`strategy_entry / order / exit / close / close_all / cancel / cancel_all` with OHLC-path fill resolution, OCA, pyramiding, slippage, commissions, margin gates, partial / FIFO-vs-ANY closes, trailing stops, and TV deferred-flip carry handling. |
38
38
| Strategy state / accessors | Supported | Position state, equity / drawdown / runup tracking, win / loss counts, full closed- and open-trade accessor methods, intraday fill counter. |
39
39
| Strategy risk | Supported | All six `strategy.risk.*` gates are wired (`engine_risk.cpp` + the fill/order gates): `allow_entry_in` direction allow-list, `max_position_size`, `max_drawdown` (abs / % of peak equity), `max_intraday_loss` (abs / % of equity), `max_cons_loss_days`, and `max_intraday_filled_orders` (latch-till-day-rollover cap-close). |
@@ -58,7 +58,7 @@
58
58
## Public C ABI
59
59
60
60
`<pineforge/pineforge.h>` is the **single canonical consumer header**.
61
-
Every compiled PineForge strategy `.so` exports exactly the 19 symbols
61
+
Every compiled PineForge strategy `.so` exports exactly the 26 symbols
| Engine internals |`engine_internal.hpp`| (private cross-TU header) |`pineforge::internal::`* types and helpers shared between engine `.cpp` partitions; not part of the public ABI. |
115
123
| Technical analysis |`ta.hpp`|`ta_moving_averages.cpp`, `ta_oscillators.cpp`, `ta_volatility_trend.cpp`, `ta_extremes_volume.cpp`, `ta_misc.cpp`| Official `ta.`* functions and series variables backed by stateful runtime classes with `compute` / `recompute`, plus `pivot_point_levels(...)` free function. |
116
124
| Math |`math.hpp`|`math.cpp`| Inline `pine_random(...)` PRNG and rolling `math::Sum` class. |
@@ -767,20 +775,20 @@ carries a forward-looking assessment using these buckets:
- **Feasibility:** *Feasible* for plotting primitives (capture series + style metadata into the `ReportC` extension or a side-channel CSV / JSON for an external renderer); *Out of scope structurally* for live `alert(...)` because PineForge produces no realtime stream.
771
-
- **Future story:** A "report-as-data" path is the obvious target — `plot(...)` and friends would write tagged time-series rows into a new diagnostics array on `ReportC`, and a Python harness would render them with Plotly / matplotlib. `alertcondition(...)` results could be returned as a list of `(bar_time, message)` triples. The graphics primitives (`label.new`, `line.new`, `box.new`) would need a small annotation runtime — straightforward but high surface area. Webhook / push-notification alerts stay out of scope.
778
+
- **Feasibility:** *Feasible* for plotting primitives (capture series + style metadata into the `ReportC` extension or a side-channel CSV / JSON for an external renderer). Realtime `alert(...)` is now also feasible because the engine has an explicit realtime lifecycle, but it still needs alert frequency/dedup state, an event ABI, and delivery plumbing.
779
+
- **Future story:** A "report-as-data" path is the obvious target — `plot(...)` and friends would write tagged time-series rows into a new diagnostics array on `ReportC`, and a Python harness would render them with Plotly / matplotlib. `alertcondition(...)` results could be returned as a list of `(bar_time, message)` triples. Alert delivery should drain deterministic engine events into an external JSON-only webhook adapter so network retries never mutate engine state.
772
780
- **Why not done yet:** Backtests already produce `TradeC[]` and per-bar diagnostics; visual plotting has not been the unblocker for any user-facing strategy validation. It is a UX feature, not a correctness feature.
773
781
774
782
#### `varip` and realtime tick semantics
775
783
776
784
`varip` (persists across realtime ticks; resets on bar close in TV);
777
785
`barstate.isrealtime`, `barstate.isnew` in realtime, `calc_on_every_tick`,
778
-
`calc_on_order_fills`, live tick streams.
786
+
`calc_on_order_fills`.
779
787
780
788
- **Feasibility:**
781
789
- `varip` itself: *Feasible*. With the bar magnifier already simulating intrabar samples, `varip` could map onto sub-bar persistence (do not reset between magnifier ticks; reset only on bar close).
782
-
- Realtime barstate flags + `calc_on_every_tick` + `calc_on_order_fills`: *Out of scope structurally* — they require a live data feed PineForge does not have.
783
-
- **Future story:** `varip` mapping to magnifier sub-bar state is the right design; currently the support checker rejects `varip` outright but that is conservative rather than fundamental. Realtime semantics would require a streaming runtime that PineForge is not built for and does not aim to be.
790
+
- Realtime barstate flags + `calc_on_every_tick` + `calc_on_order_fills`: *Feasible*. Ordered trades now reach the broker, but script recalculation still needs TradingView-style rollback, commit, and post-fill scheduling.
791
+
- **Future story:** `varip` mapping to live per-tick persistence is the right design; currently the support checker rejects `varip` outright but that is conservative rather than fundamental. The new streaming lifecycle supplies the missing data/event boundary, while rollback and codegen support remain future work.
784
792
- **Why not done yet:** `varip` use cases overlap heavily with what `var` already covers in batch mode. The realtime distinction TV makes is meaningful only when the data feed is live.
785
793
786
794
#### Import / export / library system
@@ -858,4 +866,4 @@ and [PineTS](https://github.com/LuxAlgo/PineTS), exercising the same
858
866
surface across three independent engines (PineForge hits canonical
859
867
*excellent* tier on 48 / 50 strategies vs PyneCore's 45 / 50; the 3
860
868
PyneCore-only outliers all involve bracket / trail / partial exits, see
0 commit comments