回测基本一致
This commit is contained in:
@@ -111,11 +111,23 @@ part. The engine must reproduce the EA's **fill and exit logic** bar-by-bar.
|
||||
- Keep the engine **strategy-agnostic**: it consumes bars + signal arrays + stop/target arrays and
|
||||
simulates fills. All the *strategy* math (when to enter, where to put stops) lives in the caller.
|
||||
- Implement the **intra-bar sub-tick model** (doc 03) and the **pessimistic ordering** convention.
|
||||
This is the default bar-level exit mode — fast and exact for clean-directional setups.
|
||||
- **If the EA moves its SL during a trade** (break-even, trailing, basket trailing), the bar-level
|
||||
engine is NOT trustworthy: it produces a −40% to −50% net gap vs MT5 even in a calm window (doc 03
|
||||
§7 measured failure mode). You MUST implement the **M1 tick-level exit simulation** path: load M1
|
||||
bars covering the same window as the signal bars, pass them to `engine.run(..., m1_bars=m1_bars)`,
|
||||
and the engine walks 4 synthetic ticks per M1 bar inside each higher-TF bar (direction-aware
|
||||
order), separating the BE-update tick from the SL-trigger tick. This brings the gap to ~−5% net.
|
||||
The engine should support BOTH modes and switch on whether `m1_bars` is provided.
|
||||
- Match the EA's **lot/money mode**, **spread model**, and **swap model** exactly (doc 05).
|
||||
- The first milestone is **1:1 fidelity on one known preset**: run the EA in MT5 on a short period,
|
||||
run your Python engine on the same data/preset, and reconcile trade-by-trade until the numbers
|
||||
line up within the expected gap (doc 03 "Fidelity" section). **Do not optimize anything until this
|
||||
passes** — an unvalidated engine optimizes noise.
|
||||
line up within the **target gate for the EA's class** (doc 03 §8 table):
|
||||
- Clean-directional (SL not moved intra-trade), bar-level: ≤ ~2% net gap.
|
||||
- BE / trailing, **bar-level**: unattainable — do not chase this, switch to M1 tick-level.
|
||||
- BE / trailing, **M1 tick-level**: ≤ ~10% net gap (residual spread/tick-path differences).
|
||||
**Do not optimize anything until this passes** — an unvalidated engine optimizes noise. A
|
||||
trailing/BE EA validated only on the bar-level engine is a silently-broken engine.
|
||||
|
||||
> The bundled docs use a **grid martingale** engine as the worked example because it exercises every
|
||||
> hard case (pending orders, averaging, trailing on the basket, simultaneous closes). Your EA may be
|
||||
@@ -172,6 +184,10 @@ the lab is working.
|
||||
|
||||
- **Never touch a validated engine to test an idea.** Fork it; prove the fork == original with the
|
||||
change disabled; only then test. (Doc 04.)
|
||||
- **For trailing/BE EAs, M1 tick-level exit simulation is mandatory.** A trailing/BE EA validated
|
||||
only on the bar-level engine has a −40% to −50% hidden gap vs MT5 — it is *not* a validated engine,
|
||||
no matter how good the numbers look. Always pass `m1_bars=` to the engine for EAs that move their
|
||||
SL intra-trade. (Doc 03 §7/§8.)
|
||||
- **Heavy runs go in the background.** A full-history A/B or a full Optuna study is minutes of
|
||||
compute — start it detached and poll, never block. Smoke-test first. (Doc 06.)
|
||||
- **Don't promote partial searches.** A finalist must come from a *completed* search. An interrupted
|
||||
|
||||
Reference in New Issue
Block a user