64 lines
3.3 KiB
Markdown
64 lines
3.3 KiB
Markdown
|
|
# MiniRocket
|
||
|
|
|
||
|
|
MiniRocket ported to native MQL5: a convolution transform that is never
|
||
|
|
trained, and an audit harness that states how weak an edge it could have
|
||
|
|
detected before it reports finding none.
|
||
|
|
|
||
|
|
Companion code for the MQL5 article: https://www.mql5.com/en/articles/24273
|
||
|
|
|
||
|
|
## What it does
|
||
|
|
|
||
|
|
MiniRocket turns a window of prices into roughly ten thousand features using
|
||
|
|
84 fixed convolution kernels spread over a dilation schedule. Nothing about
|
||
|
|
the kernels is learned, which is what makes the transform cost about two
|
||
|
|
milliseconds a window and need no ONNX, no gradient descent and no Python at
|
||
|
|
runtime. `CMiniRocket` implements it; `CRidgeClassifier` solves the linear
|
||
|
|
model in the dual, so a single eigendecomposition serves the whole penalty
|
||
|
|
grid and leave-one-out error falls out in closed form.
|
||
|
|
|
||
|
|
The port is checked for bit equality against an independent float64
|
||
|
|
reimplementation rather than assumed correct. A transform that is subtly wrong
|
||
|
|
still returns plausible features, so `MiniRocketVerify.mq5` writes the input
|
||
|
|
and the output at seventeen significant digits and `minirocket_reference.py`
|
||
|
|
diffs them exactly. `compare_sktime.py` repeats the check against sktime's own
|
||
|
|
source as a third party.
|
||
|
|
|
||
|
|
The harder half is that a null result is ambiguous: point a model at a classic
|
||
|
|
setup, find nothing, and you cannot tell whether the setup is worthless or the
|
||
|
|
pipeline is broken. `SetupLab.mqh` settles that with controls instead of
|
||
|
|
assurances. A planted label the features can provably recover, that same label
|
||
|
|
with a quarter of its answers flipped, and a coin flip all travel the
|
||
|
|
identical path as the seven real setups.
|
||
|
|
|
||
|
|
That calibration is the point. The planted label reaches AUC 0.803 and the
|
||
|
|
coin flip sits at 0.499, so the harness detects what is there and nothing when
|
||
|
|
there is nothing. The corrupted label lands at 0.546, which puts the
|
||
|
|
resolution of this test bed at roughly AUC 0.55 at these sample sizes. Read
|
||
|
|
against that floor, all seven setups on six years of EURUSD H1 come back null,
|
||
|
|
and the article is explicit about which rows have the sample size to support
|
||
|
|
that claim and which only support "not enough signals to say".
|
||
|
|
|
||
|
|
## Layout
|
||
|
|
|
||
|
|
```
|
||
|
|
Include/MiniRocket/MiniRocket.mqh the transform: 84 kernels, dilations, PPV pooling
|
||
|
|
Include/MiniRocket/RidgeClassifier.mqh ridge in the dual, closed-form leave-one-out
|
||
|
|
Include/MiniRocket/SetupLab.mqh setups, controls, labelling and the purged split
|
||
|
|
Scripts/MiniRocket/MiniRocketVerify.mq5 fixture, schedule, timings, and the CSV dump
|
||
|
|
Scripts/MiniRocket/SetupAudit.mq5 every setup and control through one pipeline
|
||
|
|
Scripts/MiniRocket/MiniRocketFit.mq5 fits one setup and writes the model file
|
||
|
|
Indicators/MiniRocket/MiniRocketProb.mq5 scores each trigger on a live chart
|
||
|
|
Files/MiniRocket/minirocket_reference.py independent float64 reference
|
||
|
|
Files/MiniRocket/compare_sktime.py diffed against sktime's own source
|
||
|
|
Files/MiniRocket/level_invariance.py what the features can and cannot see
|
||
|
|
```
|
||
|
|
|
||
|
|
Run `MiniRocketVerify.mq5` first, then `minirocket_reference.py` on the two
|
||
|
|
CSVs it writes. If the features do not match exactly, nothing downstream is
|
||
|
|
worth reading.
|
||
|
|
|
||
|
|
## Disclaimer
|
||
|
|
|
||
|
|
Educational code. Past behaviour of any model or dataset says nothing about
|
||
|
|
future results. Test on your own data and broker conditions before drawing
|
||
|
|
conclusions.
|