{"id":50657379,"url":"https://github.com/pineforge-4pass/pineforge-corpus","last_synced_at":"2026-06-08T00:11:33.763Z","repository":{"id":358156659,"uuid":"1229935712","full_name":"pineforge-4pass/pineforge-corpus","owner":"pineforge-4pass","description":"PineForge TV validation corpus (maintainers only)","archived":false,"fork":false,"pushed_at":"2026-05-31T18:53:20.000Z","size":53499,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-31T20:23:13.621Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pineforge-4pass.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-05T14:19:07.000Z","updated_at":"2026-05-31T18:53:24.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/pineforge-4pass/pineforge-corpus","commit_stats":null,"previous_names":["fullpass-4pass/pineforge-corpus","pineforge-4pass/pineforge-corpus"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pineforge-4pass/pineforge-corpus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pineforge-4pass%2Fpineforge-corpus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pineforge-4pass%2Fpineforge-corpus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pineforge-4pass%2Fpineforge-corpus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pineforge-4pass%2Fpineforge-corpus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pineforge-4pass","download_url":"https://codeload.github.com/pineforge-4pass/pineforge-corpus/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pineforge-4pass%2Fpineforge-corpus/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34042766,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-07T02:00:07.652Z","response_time":124,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-08T00:11:33.039Z","updated_at":"2026-06-08T00:11:33.758Z","avatar_url":"https://github.com/pineforge-4pass.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PineForge validation corpus\n\nThe corpus is PineForge's reproducibility kit for the parity claim in the\nproject README. Every probe is a hand-written, clean-room PineScript v6\nstrategy paired with TradingView's exported trade list and PineForge's own\ntrade list, so a third party can diff the two CSVs and confirm engine\nbehaviour matches TradingView on the same bar feed.\n\n## Headline parity\n\n- **246** verified strategies, all under `corpus/validation/`.\n- **~375,000 trades** total across the suite (TV: 375,453; engine: 375,548 — `+95` ≈ 0.03 % over TV).\n- **245** excellent (bit-for-bit or within strict thresholds on every\n  parity dimension).\n- **1** documented anomaly — `anomaly-equity-mirror-strategy-equity-01` —\n  where TradingView's broker emulator exhibits non-deterministic\n  accept/reject behaviour at the exact 1× equity margin boundary. Engine\n  is deterministic and correct; full write-up lives in\n  `pineforge-utils/parity-anomalies/tv-margin-boundary.md`.\n- **0** strong / moderate / weak.\n\nThe canonical, regenerated-each-sweep disposition table is\n[`validation_report.md`](validation_report.md) (rendered as\n`validation_report.html` and `validation_report.pdf`).\n\n## Artifact tuple\n\nEach probe directory ships four files in git:\n\n| File                | Source                       | Role                                                       |\n| ------------------- | ---------------------------- | ---------------------------------------------------------- |\n| `strategy.pine`     | hand-written                 | PineScript v6 source                                       |\n| `generated.cpp`     | pineforge-codegen transpiler | C++ output of the transpiler over `strategy.pine`          |\n| `tv_trades.csv`     | TradingView export           | TV broker emulator's trade list for `strategy.pine`        |\n| `engine_trades.csv` | PineForge                    | Engine's trade list for the same script (TV-format CSV)    |\n\n`generated.cpp` is the transpiler output of our own clean-room\nPineScript and ships under the same Apache-2.0 license as\n`strategy.pine`. It is included in-tree so public users can rebuild\nwithout needing access to the separate, source-available `pineforge-codegen`\ntranspiler — `cmake --build build --target corpus_strategies` compiles\neach `generated.cpp` into a per-strategy shared library. The compiled\n`strategy.dylib` / `.so` / `.dll` are platform-specific build artefacts\nand remain ignored.\n\n## Reference OHLCV\n\nThe comparison feed is **Binance ETH-USDT-USDT 15-minute bars**, with an\noptional 1-minute companion for `bar_magnifier` and lower-timeframe probes:\n\n- `data/ohlcv_ETH-USDT-USDT_15m.csv` — primary 15m bar feed.\n- `data/ohlcv_ETH-USDT-USDT_15m_warmup6m.csv` — same window plus six\n  months of leading warmup bars; used by default when present so TA, MTF,\n  pivot, and equity-feedback state starts closer to TradingView's chart\n  state.\n- `data/ohlcv_ETH-USDT-USDT_1m.csv` and `..._1m_warmup6m.csv` — 1m feed\n  for `magnifier-*` and `ltf-*` probes.\n\n## Layout\n\n```\ncorpus/\n├── validation/                246 probes — surface-driven probe family\n│   ├── ta-*                    50 probes — TA built-in math (rsi, macd, sma, ...)\n│   ├── order-*                 40 probes — entry/exit/cancel placement\n│   ├── bracket-*               13 probes — TP/SL via strategy.exit / strategy.order\n│   ├── udt-*                   22 probes — user-defined types + methods\n│   ├── mtf-*                   15 probes — request.security regular HTF\n│   ├── matrix-*                 6 probes — matrix\u003cT\u003e typed/generic\n│   ├── analyzer-*               6 probes — engine analyzer / parity isolation\n│   ├── composite-*             52 probes — multi-surface integration (community-style)\n│   ├── pyramid-*                4 probes — pyramiding=N\n│   ├── oca-*                    3 probes — OCA group cancel/reduce/none\n│   ├── magnifier-*              3 probes — bar_magnifier sub-bar walks\n│   ├── ltf-*                    2 probes — request.security_lower_tf arrays\n│   ├── session-*                2 probes — session() / TZ / DST\n│   ├── recompute-*              2 probes — calc_on_every_tick / TA recompute\n│   ├── na-*                     2 probes — na propagation\n│   ├── cap-*                    2 probes — intraday cap (max_intraday_filled_orders)\n│   ├── barstate-*               2 probes — barstate.* checks\n│   ├── vwap-*                   2 probes — VWAP band pricing / fills\n│   ├── risk-*                   1 probe  — risk gates / limits\n│   ├── stats-*                  1 probe  — performance stats / reporting\n│   ├── symbol-*                 1 probe  — ticker/symbol specification mapping\n│   ├── timeframe-*              1 probe  — script_tf/input_tf timeframe handling\n│   └── anomaly-*                1 probe  — documented TV non-determinism\n├── data/                       reference OHLCV (Binance ETH-USDT-USDT 15m + 1m)\n├── LICENSE                     Apache-2.0\n├── NOTICE                      attribution\n├── LEGAL.md                    provenance / trademarks\n├── README.md                   this file\n├── CMakeLists.txt              per-strategy .so build glob\n├── .gitignore                  ignores compiled strategy.dylib/.so/.dll only\n├── validation_report.md        canonical parity disposition, regenerated each sweep\n└── validation_report.{html,pdf}   rendered from .md\n```\n\nTotal: **246** probes.\n\n## Naming convention\n\nEvery probe directory follows:\n\n```\n\u003ccategory\u003e-\u003cdescriptive-slug\u003e-NN[a-z]?\n```\n\n- **`\u003ccategory\u003e`** — one of the 19 surface categories below. The category\n  is the engine surface or PineScript feature the probe is built to\n  exercise.\n- **`\u003cdescriptive-slug\u003e`** — kebab-case description of the specific\n  behaviour under test (e.g. `atr-trail-series-int-points`,\n  `kalman-filter-1d`, `bb-kc-squeeze-release`).\n- **`NN`** — two-digit sequence number, used to disambiguate when more\n  than one probe lands on the same `(category, slug)` pair.\n- **`[a-z]?`** — optional letter suffix, used **only** for documented\n  A/B variant pairs that share the same numeric slot (e.g.\n  `barstate-isconfirmed-magnifier-on-01a` vs\n  `…-magnifier-off-01b`).\n\nThe 23 categories (with probe counts):\n\n| Category    | Count | Surface exercised                                          |\n| ----------- | ----: | ---------------------------------------------------------- |\n| `composite` |    52 | Multi-surface integration probes (community-style scripts) |\n| `ta`        |    50 | TA built-in math (rsi, macd, sma, hma, …)                  |\n| `order`     |    40 | Entry/exit/cancel order placement                          |\n| `udt`       |    22 | User-defined types + methods                               |\n| `mtf`       |    15 | `request.security` regular HTF                             |\n| `bracket`   |    13 | TP/SL via `strategy.exit` / `strategy.order`               |\n| `matrix`    |     6 | `matrix\u003cT\u003e` typed and generic                              |\n| `analyzer`  |     6 | Engine analyzer / parity isolation                         |\n| `pyramid`   |     4 | `pyramiding=N`                                             |\n| `oca`       |     3 | OCA group cancel / reduce / none                           |\n| `magnifier` |     3 | `bar_magnifier` sub-bar walks                              |\n| `session`   |     2 | `session()` / TZ / DST                                     |\n| `recompute` |     2 | `calc_on_every_tick` / TA recompute                        |\n| `na`        |     2 | `na` propagation                                           |\n| `ltf`       |     2 | `request.security_lower_tf` arrays                         |\n| `cap`       |     2 | Intraday cap (`max_intraday_filled_orders`)                |\n| `barstate`  |     2 | `barstate.*` checks                                        |\n| `vwap`      |     2 | VWAP band pricing / fills                                  |\n| `risk`      |     1 | risk gates / limits                                        |\n| `stats`     |     1 | performance stats / reporting                              |\n| `symbol`    |     1 | ticker/symbol specification mapping                        |\n| `timeframe` |     1 | script_tf/input_tf timeframe handling                      |\n| `anomaly`   |     1 | Documented TV non-determinism                              |\n\n## Where the numbers come from\n\nThe headline figure is produced by the verifier sweep that emits\n[`validation_report.md`](validation_report.md). That report is the\nauthoritative disposition for every probe — tier, profile, per-dimension\ndeltas, anomaly verdicts.\n\nThe full pipeline (build + run + verify across the whole tree) is one\ncommand:\n\n```bash\nJOBS=8 scripts/run_corpus.sh\n```\n\nThat script:\n\n1. Configures CMake with `-DPINEFORGE_BUILD_CORPUS_STRATEGIES=ON`.\n2. Builds `libpineforge.a` plus one `strategy.so` per probe via\n   `cmake --build build --target corpus_strategies`.\n3. Loads each `strategy.so` through `scripts/run_strategy.py`, runs it\n   against `corpus/data/ohlcv_ETH-USDT-USDT_15m.csv` (or the warmup\n   variant when present), and writes `engine_trades.csv` next to the\n   probe.\n4. Runs `scripts/verify_corpus.py --all` to produce the report.\n\n## Reproducing parity locally\n\nNo transpiler access required — `generated.cpp` ships in-tree.\n\n```bash\n# 1. Clone the engine and pull this corpus submodule\ngit clone https://github.com/fullpass-4pass/pineforge-engine.git\ncd pineforge-engine\ngit submodule update --init corpus\n\n# 2. Build all per-strategy .so files, run them, and verify\nJOBS=8 scripts/run_corpus.sh\n```\n\nYou need the engine repo, this corpus, and a C++17 compiler. The engine\nis deterministic given a fixed bar feed, the shipped `generated.cpp`,\nand a fixed runtime build. If a probe's rebuilt `engine_trades.csv`\ndisagrees with the committed copy, that is a bug — please open an issue.\n\n## CSV format\n\nBoth `tv_trades.csv` and `engine_trades.csv` use TradingView's row layout:\n\n- **Two rows per trade**, sharing the same `Trade #`. The exit row is\n  emitted before the entry row (TV convention; PineForge mirrors it for\n  direct diff).\n- **Reverse-chronological by trade number** (newest first).\n- **Time format**: `YYYY-MM-DD HH:MM`. Engine CSVs are UTC. TradingView\n  exports use the chart's wall-clock timezone; this corpus defaults to\n  UTC+8 unless a probe `inputs.json` overrides `tv_trades_csv_tz`.\n\n`tv_trades.csv` (TradingView's actual export):\n\n```\nTrade #,Type,Date and time,Signal,Price USDT,Position size (qty),...\n14,Exit long,2026-04-27 20:30,TPSL,2291.52,1,2291.52,...\n14,Entry long,2026-04-27 20:15,…,2289.7,1,2289.7,…\n```\n\n`engine_trades.csv` (PineForge's mirrored format, fewer columns —\nPineForge does not currently emit TV's \"Signal\" tag or percent-of-position\nMFE/MAE):\n\n```\nTrade #,Type,Date and time,Price,Qty,Net PnL,Net PnL %,MFE,MAE,Cumulative PnL\n14,Exit long,2026-04-27 20:30,2291.520000,1,1.820000,0.0795,2.250000,0.160000,-38.120000\n14,Entry long,2026-04-27 20:15,2289.700000,1,1.820000,0.0795,2.250000,0.160000,-38.120000\n```\n\n`Net PnL` and `Net PnL %` are per-trade. `Cumulative PnL` is the\nengine-side running total. `MFE`/`MAE` are dollars per unit qty,\nmirroring TV's \"Favorable / Adverse excursion USD\".\n\n## Parity thresholds\n\nThe verifier (`scripts/verify_corpus.py`) applies one of two threshold\nprofiles per probe and emits a tier label:\n\n### Profiles\n\n| Dimension                  | STRICT  | PRODUCTION |\n| -------------------------- | ------: | ---------: |\n| Trade-count delta          |   1.0%  |       1.0% |\n| Entry-price p90 delta      |   0.01% |      0.01% |\n| Exit-price p90 delta       |   0.01% |      0.05% |\n| Per-trade P\u0026L p90 delta    |   1.0%  |       1.0% |\n\nPRODUCTION relaxes only the exit-price tolerance (5×) to absorb sub-bar\nbroker-side fill drift on probes that use `strategy.exit`. The verifier\nauto-detects `strategy.exit` in `strategy.pine` and selects PRODUCTION\nfor those probes; everything else stays on STRICT.\n\nA trade is \"matched\" when engine and TV agree on direction and entry/\nexit times fall within a 1-hour gating window (plus a $3 entry-price\ngate to defend against same-bar duplicates). The PnL p90 calc applies a\nnear-zero filter (`|tv_pnl| \u003e $0.01`) to avoid div-by-near-zero blow-up\non TV's magnifier zero-PnL trades.\n\n### Tier labels\n\n| Tier          | Meaning |\n| ------------- | ------- |\n| `excellent`   | All four dimensions pass the resolved profile. Bit-for-bit or within strict-profile thresholds. |\n| `strong`      | Dimensions pass a relaxed envelope (5× thresholds) — close but not excellent. Used as a pass-with-caveat tier. |\n| `moderate`    | Some dimensions exceed the strong envelope but trades still align meaningfully. Investigate. |\n| `weak`        | Significant divergence. Real bug or probe-design issue. |\n| `minimal`     | Probe produces zero engine trades or zero TV trades — nothing to compare. |\n| `anomaly`     | Engine output is correct per Pine spec; TV is non-deterministic on this probe. Documented per-probe via `inputs.json::expected_tier: \"anomaly\"` plus a `notes` field with the deep-analysis write-up. Excluded from headline excellent count. Currently 1 probe (`anomaly-equity-mirror-strategy-equity-01`). |\n| `engine_only` | Engine produces correct trades that intentionally diverge from TV (e.g., engine fires a bar TV's broker emulator silently drops). Documented per-probe via `inputs.json::validation_overrides::expect_tv_match: false` plus an `expect_tv_match_reason` write-up. Currently 0 probes. |\n| `missing`     | Required artefact (TV CSV or engine CSV) absent. Should never appear in committed state. |\n\nThe `anomaly` and `engine_only` overrides only fire when the computed\ntier would be below `excellent` — a future engine fix that lifts a\ndocumented divergence to bit-for-bit match still reports as `excellent`,\nnot silently masked.\n\n## Publishing posture\n\nThe corpus is published under **Apache-2.0**, matching the engine. Every\n`strategy.pine` is a clean-room PineForge original — no third-party\nPineScript is redistributed. TradingView trade-list CSVs are factual\nrecords of running each script on TV's broker emulator, included only for\nparity verification. OHLCV is public market data from Binance USDT-M\nfutures. See [`LEGAL.md`](LEGAL.md) for the full provenance and trademark\nnotes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpineforge-4pass%2Fpineforge-corpus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpineforge-4pass%2Fpineforge-corpus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpineforge-4pass%2Fpineforge-corpus/lists"}