tools: add DASH-001 TOOL-001 TOOL-002 TOOL-003 and RUNNER-001 utilities

This commit is contained in:
2026-08-16 16:59:18 -04:00
parent 83d25cb2cd
commit 0a2106a7a6
24 changed files with 5440 additions and 0 deletions

108
tools/runnersweep/README.md Normal file
View File

@@ -0,0 +1,108 @@
# runnersweep
`runnersweep.py` analyzes NT8 Strategy Analyzer exports for the DEC-20260815-01 runner redesign sweep. It is offline analysis only: no strategy code changes, no NinjaTrader assembly references, no DLL involvement.
I chose Strategy Analyzer exports rather than a direct SDK-core harness. The mandatory validity rules require Tick Replay with a non-time-based HFT Algo Bars primary series; using Strategy Analyzer exports preserves NT8's bar construction instead of approximating it outside NT8.
## Sweep Grid
Full factorial, 18 combinations:
- `BreakevenTriggerTicks`: `20`, `28`, `36`, `44`, `52`, `disabled`
- `RunnerTrailTicks`: `12`, `20`, `28`
## Mandatory Validity Rules
Each run is marked invalid unless the export or metadata proves:
- Strategy Analyzer start date is at least 60 trading days before the evaluation window start.
- Tick Replay was enabled.
- Daily bars loaded are reported and at least 60.
The result table reports `Daily Bars` for each combination as warm-up proof.
## Expected Export Shape
The tool accepts either one combined CSV or a directory of CSVs. It reads files recursively.
Parameters can be supplied as columns:
- `BreakevenTriggerTicks`
- `RunnerTrailTicks`
Or in filenames, for example:
- `BE20_Trail12.csv`
- `BreakevenTriggerTicks-disabled_RunnerTrailTicks28.csv`
Useful trade columns:
- `Profit`, `Net profit`, `PnL`, or `P&L`
- `Leg`, `Entry name`, `Exit name`, `Signal name`, `EntrySignal`, `ExitSignal`
- `R`, `R Multiple`, or `Initial Risk`
- `StartDate`, `EvaluationStartDate`, `TickReplay`, `DailyBarsLoaded`
Runner rows are identified by `runner`/`run` in leg or signal names. Scaler rows are excluded from runner-leg metrics but included in combined strategy metrics.
## Metadata Sidecar
If Strategy Analyzer exports do not include mandatory metadata, provide `metadata.json`:
```json
[
{
"BreakevenTriggerTicks": 20,
"RunnerTrailTicks": 12,
"StartDate": "2026-05-01",
"EvaluationStartDate": "2026-08-01",
"TickReplay": true,
"DailyBarsLoaded": 87
}
]
```
## Usage
Markdown table:
```powershell
python tools\runnersweep\runnersweep.py "C:\exports\runner-sweep" --metadata "C:\exports\runner-sweep\metadata.json"
```
JSON:
```powershell
python tools\runnersweep\runnersweep.py "C:\exports\runner-sweep" --metadata "C:\exports\runner-sweep\metadata.json" --json
```
If the evaluation start date is not in the exports:
```powershell
python tools\runnersweep\runnersweep.py "C:\exports\runner-sweep" --eval-start 2026-08-01
```
## Output Metrics
Per combination:
- runner net P&L
- runner win rate
- runner average R
- percent of runner exits at breakeven
- percent of runner exits at trail stop
- percent of runner exits at full stop
- combined strategy profit factor
- combined max drawdown
- combined trade count
## Recommendation Logic
Only valid combinations are considered.
If every valid setting has runner net P&L `<= 0`, the recommendation is explicitly:
```text
Recommendation: disable the runner leg. Runner net P&L is non-positive for every valid setting.
```
Otherwise, the tool recommends the valid combination with the highest runner net P&L, using combined PF and lower max drawdown as tie-breakers.