# Miroscope — Runbook (day-to-day operation)

For Michael. Everything the EA does, and what you do each day you run it.

## What it is

Miroscope is a MetaTrader 5 Expert Advisor that trades one thing: the 1-2-3
reversal. It watches the market on two lanes — D1 bias traded on H1 (default),
or H4 bias traded on M15 — and when a 1-2-3 prints in a pullback zone with the
bias behind it, it builds a setup: entry, stop loss, two take-profits, an
invalidation line, and a scale-in level. Then it manages the trade exactly the
way the plan specifies: first entry at the setup, a second entry if price
revisits the scale level, 75% off at TP1 (+1.5R) with the stop moved to
breakeven-plus, and the runner left to TP2 (+3R).

## Files

- `ea/Miroscope_EA_P2.mq5` — the EA. Compile in MetaEditor before use.
- `source/Miroscope_Scanner_P1.mq5` — the scanner (alerts only, never trades).
- `risk/risk_engine.py` — the risk formulas, plain Python, for reference.

## First-time setup

1. Open MetaEditor, compile `Miroscope_EA_P2.mq5`. It MUST compile with zero
   errors before it goes on any chart, demo or live.
2. Drag it onto an H1 chart (lane 0) or M15 chart (lane 1) of the symbol.
3. In the inputs you will see **TRADING GATES — both must be true**:
   `InpLiveTrading` and `InpAllowOrders`. They default to FALSE, and with
   either one false the EA only draws setups as on-chart signals and places
   nothing. This is deliberate. Turn them on only when you mean it.
4. Check the chart: the top-left shows the mode (TRADING OFF - SIGNALS ONLY vs
   LIVE TRADING ON) and the current bias. If you do not see the mode line, the
   EA is not running.

## Daily routine

- **Morning:** glance at the chart. Active setups show their entry (blue), stop
  (red), TP1/TP2 (green), and invalidation (orange, pending only). The bias line
  tells you which direction it is allowed to trade today.
- **During the day:** do nothing. The EA manages entries, scale-ins, partials,
  and the breakeven move. Invalid setups die on their own before costing money.
- **21:00 server time:** the EA cancels all pending setups and flattens open
  positions. Nothing is left exposed overnight by design.
- **After a -3% day:** the EA stops taking new setups until tomorrow. Leave it
  alone; it resumes on its own.

## What the numbers mean

- Risk per setup: 1% of balance (InpRiskPct). First entry carries 60% of that,
  the scale-in 40%. Worst case on a setup where both entries fill and stop out
  is the full 1%, never more.
- TP1 at +1.5R takes 75% off ("15 off"). The runner is 25% ("5 running") to +3R.
- A pending setup dies free if price crosses its invalidation line, or after 12
  trigger bars with no fill.

## Safety rules (do not change these casually)

- Never turn on both trading gates on a live account until the EA has passed a
  full paper-trading run on a demo and you have said go explicitly.
- Never remove the session cutoff or the daily loss halt without replacing them
  with something stricter.
- If the mode line ever reads LIVE TRADING ON and you did not turn it on,
  remove the EA from the chart immediately and ask what changed.

## When something looks wrong

- No setups for days: normal. The zone gate is the tightest filter by design;
  it fires only when price is actually in a pullback zone with the bias.
- A setup vanished with no trade: it was invalidated or expired. That is the
  system working, not a bug.
- Numbers on the dashboard disagree with your broker's: the EA reads your
  broker's own price feed; the scanner file had a symbol-mismatch defect in an
  older version, fixed in P1. If you suspect it, compare the ATR readout
  against the broker's ATR(14) on the same timeframe.

## Honest limits of this document

This runbook describes the EA as built and logic-tested. It was verified by
executing a Python port of its decision logic (see ea/TEST-RESULTS-P2.md), not
by running the .mq5 itself — there is no MQL5 compiler or MetaTrader in the
build environment. Backtest results are in backtest/BACKTEST-REPORT.md; paper
trading on live market data has not happened yet and is the next required gate.
