# MIROSCOPE — ChatGPT catch-up briefing

Paste this as your FIRST message in the ChatGPT MQL5 EA code generation chat,
then attach the files listed at the bottom. This brings ChatGPT fully up to
speed so it and Remy (my other AI) stay in congruence.

---

## 1. What Miroscope is

Miroscope is my independent MetaTrader 5 trading system, rebuilt from scratch
after I cut ties with a former collaborator's program (Tommy Smith — he is
completely out of this project, do not reference his work). It has two parts:
a pattern scanner and an executing Expert Advisor. Everything runs on a
MetaQuotes DEMO account. There is NO live trading, no real money, no broker
beyond the demo. Live trading stays OFF until I explicitly authorize it AND
the strategy passes paper-trading gates.

## 2. The strategy (base version)

- Lane: D1 bias traded on H1.
- Bias: D1 close vs 50-period SMA on D1 (closed bar, shift 1). Close above SMA
  = UP bias (+1), below = DOWN bias (-1).
- Entry — 1-2-3 reversal pullback on H1:
  - BUY: last closed H1 bar bearish AND D1 bias UP AND price inside the
    pullback zone (within 0.5x ATR of the 20-period trigger MA), plus bar-2
    shape (break of bar-1 low with wick rejection), bar-3 confirmation, RSI(14)
    <= 65.
  - SELL: mirror image — last closed H1 bar bullish AND D1 bias DOWN AND in
    the pullback zone, bar-2 break of bar-1 high with rejection, bar-3
    confirmation, RSI >= 35.
- Trade management: ATR-based stop; 75% of position closed at TP1 = 1.5R;
  runner to TP2 = 3.0R; stop moved to breakeven + 0.1R after the partial.
  Max 1 setup per direction, max 8 setups, pending orders expire after 12
  trigger bars, no new setups after a -3% day, everything flattened at 21:00
  server time. Risk per setup: 1% of balance.
- Order placement is "smart": uses the planned limit level when placeable,
  converts to stop/market when price moved through (chase capped at 0.25R).

## 3. Code state (what's attached)

- `Miroscope_EA_P2C.mq5` — latest full EA source in my workspace. This is the
  reference implementation of the strategy above, and the SOLE base for all
  variant work.
- `Miroscope_EA_P2.mq5` — earlier base version P2C was built on.
- P2B was the original attempt. It had an error code and was retired (2026-09-30). P2C is the sole current base and control. Do not build on P2B or treat it as authoritative for anything.
- `PHASE2-NOTES.md` — EA build notes. `BACKTEST-REPORT.md` — backtest results.
  `RUNBOOK.md` — day-to-day operation.

## 4. What testing has already proven

- Backtest on REAL data: 10,605 H1 bars of EURUSD, 2025-01-01 to 2026-09-22.
  100 trades, 31% win rate, profit factor 0.78, expectancy -0.139R, max
  drawdown 27.59%, account -13.82%. The strategy AS SPECIFIED loses on this
  dataset: 69% of trades are full stop-outs, only 16% ever reach TP2. The
  1.5R/3R payoff structure needs a win profile the pattern is not producing.
- Live demo forward test (MetaQuotes-Demo, $100,000): 4 trades, 2026-09-25 to
  2026-09-30, ALL full stop-outs —
  USDCHF buy -$992.27, USDJPY sell -$988.98, GBPUSD sell -$587.73,
  USDCHF buy -$978.44 = -$3,547.42 total, balance $96,452.58.
  The ~$900 per-trade loss is just lot size x stop distance, not a market
  constant. Four trades prove nothing statistically.

## 5. Active experiment (started 2026-09-30)

My thesis: the EA may be systematically picking the wrong side, so we invert
it two ways. These are GENUINELY DIFFERENT trades, verified against the
detector logic — not the same trade renamed.

- Variant P2D ("flip the signal"): invert the bias BEFORE the pattern checks
  (bias = -BiasDirection()), everything else identical. Net effect: BUY
  bearish H1 pullback bars when D1 bias is DOWN; SELL bullish H1 pullback bars
  when D1 bias is UP. This buys pullbacks against the daily trend
  (counter-trend pullback entries). The on-chart bias label must show both the
  raw bias and the traded (inverted) bias so nothing is misread.
- Variant P2E ("flip the action"): keep the bias as-is, flip the returned
  trade direction (base BUY signal becomes SELL, base SELL becomes BUY), with
  SL/TP mirrored for the new direction. Net effect: fades the pullback,
  betting it extends into a full reversal against the daily bias.
- Both variants are built from P2C's logic. P2B is dead and plays no role.
- New variants get distinct magic numbers (P2C uses 20260922). All existing
  risk/session management, gates, and expiry logic stay untouched.
- Test protocol: demo only, fixed fractional risk per trade, log every trade
  with entry/SL/TP/variant/symbol, minimum sample before judging (no verdicts
  off a handful of trades), keep/kill/iterate decision rules per variant.

## 6. Hard boundaries (non-negotiable)

1. DEMO ONLY. Never write anything that enables live trading, and never
   assume I will trade real money. Live trading needs my explicit go-ahead
   plus passed paper-trading gates.
2. NO repository or GitHub access. Work ONLY from the files I attach in this
   chat. Never ask for repo access.
3. You cannot compile MQL5. I compile in MetaEditor on my machine. Write code
   that compiles with zero errors on the first pass: no undeclared
   identifiers, no invented API calls, strict type discipline.
4. Tommy Smith is out of this project. Do not reference or incorporate his work.

## 7. How to work with me in this chat

- Fully finished work in EVERY single response. No "want me to continue?",
  no loose ends, no follow-up questions to me.
- When I ask for a variant, give the COMPLETE .mq5 file, not a diff or a
  snippet, unless I explicitly ask for a diff.
- Explain the reasoning briefly, then the code. Keep explanations tight.

---

## Files to attach with this briefing

1. This briefing (or its contents pasted as the first message)
2. `Miroscope_EA_P2C.mq5` (reference implementation — the ONLY base)
3. `PHASE2-NOTES.md`, `BACKTEST-REPORT.md`, `RUNBOOK.md` (context)
