Overview
RiskManager is a pre-committed game-plan trading system. The idea is to move the risk decision out of the moment of temptation: you set a plan before the session, and the system enforces it during. It has three parts that share one contract.
| Part | What it is | Where |
|---|---|---|
| MT5 EA | The engine and the hands — computes market structure, draws setups, sends orders, enforces the plan. The single source of truth. | RiskManager.mq5 / .mq4 |
| Web bridge | A zero-dependency Node server. Stores each EA's state, relays commands, hosts the dashboard and the journal. | webapp/server.mjs → 7r4d3.net |
| Phone app | The dashboard installed as a PWA — same code, home-screen icon, push alerts. | Install from 7r4d3.net |
Design rule: the EA computes, the web app displays. No swing, trend or FVG is ever recalculated in the browser — every value shown was computed by the EA and shipped in its state snapshot. One source of truth.
The Daily Journal
The journal records what state each chart is in at set times through the day. You return to the charts at those moments and log an observation per symbol. Some fields AUTO the EA can compute and fill for you; others MANUAL are your judgement.
The old spreadsheet codes (T0, p, T1…) are renamed to be self-explanatory. The mapping and definitions below
are the working reference — the schema file journal-schema.json is the single source,
so correcting a definition there updates the table, the storage and this page's intent together.
View controls sit above the table: Compact swaps the friendly labels for the short codes (T0, x, p…) and tightens the cells; Habits / Trade collapse those groups; and a Symbols chooser shows a subset — so the few symbols you trade today fit in one view.
The day, in order
| When (ET) | Field | Was | Src | What it records |
|---|---|---|---|---|
| daily close | Prior Day | T0:Type | AUTO | Type of yesterday's closed daily candle (G/Y/B/R). |
| new open | Flow Call | p: | MAN | Your prediction of which way flow breaks (u/d/i/o). |
| 00:00 | Stalk Hit | T1 | AUTO | Did price reach the daily stalk zone (t/f). |
| 07:00 | Session Gap | T2 | AUTO | Gap between price and the 19:45 session open (t/f). |
| 09:00 | Range Play | T3 | MAN | How RTH will interact with the overnight range. |
| any time | HTF Break | x: | AUTO | Weekly / Mx high or low breached (xW / xMx). |
| 12:00 | Midday Call | T4 | MAN | Predicted day-type outcome (G/Y/B/R). |
| end of day | Result | R | AUTO | Actual realised day type. |
| pre-session | Stance | Stance | MAN | The day's strategy — home run, base hits, preserve, manage. |
Prior Day (was T0) — the daily candle type
Fixed the moment yesterday's daily candle closes, classified by Period Trend (defined below):
Flow Call (was p) — your break prediction
Made when the new daily candle opens. It predicts which way flow breaks, not where the candle closes:
A candidate for a machine-learning prediction later; manual for now.
Range Play (was T3) — RTH vs the overnight range
At 09:00, before the 09:30 open: how will the day session interact with the overnight session's range?
i = internal, e = external.
The other fields
- Stalk Hit (T1) — at midnight ET, did price trade into the daily stalk zone? Fires an alert. AUTO
- Session Gap (T2) — at 07:00, is there a gap between price and the 19:45 session open? The EA already computes this (
S.GAP). AUTO - HTF Break (x) — weekly or Mx high/low breached, recorded at most once per week, with an alert.
xW/xMx. AUTO - Midday Call (T4) — around noon, predict today's day-type outcome (G/Y/B/R). MANUAL
- Result (R) — today's realised day type, to score the Midday Call against. AUTO
- Stance — the day's game plan: Offense / Neutral / Defense / Defended. MANUAL
Habits (Sleep, Fuel, Exercise, Discipline, 0-10) and Trade (Forced? Reacted? Overleveraged? Homerun?) round out each row.
Weekends: only BTC and ETH stay editable; the 24×5 symbols hatch out.
What MT5 Looks At
The definitions the EA computes and the journal draws on. This section is my current understanding — flag
anything off and it gets corrected here. Deep detail lives in TRADING_SYSTEM.md and the Pine
source ThrustStructure.pine.
Period Trend, Flow & Trend
Period Trend — the journal's trend, and the simplest: it is set by the previous closed candle. Break that candle's high and the period trend is up; break its low and it is down. Prior Day, Midday Call and Result are all classified by it. This is separate from the algo's flow below — the algo's flow is right for the algo, but the journal wanted its own definition.
Flow (tFlow) is the algo's micro directional state from the thrust engine. Starting 'up',
when price breaks below the lowest low of the last 4 bars, flow flips to 'down' and the highest high since
becomes a swing high; the mirror flips it back up. A flow change is this flip. It drives the
engine's setups — not the journal's Period Trend.
Trend (tTrend) is bigger, set by a break of structure (BOS) — price breaking a
confirmed swing. It was the algo half of the parked R definition; unused by the journal until R is
pinned down.
The three engines
| Engine | Timeframe | What it produces |
|---|---|---|
| M15 Thrust | 15-minute | Pivots, thrusts, swing high/low, flow, trend, BOS vs CHOCH, dealing-range %. The primary structure engine. |
| H4 Thrust | 4-hour | The same structure one level up, used for higher-timeframe agreement. |
| M5 Close-Trend | 5-minute | The ctrend close-based trend; flips drive the M5 close-trend alert. |
Core terms
- Pivot — a 4-bar local high or low.
- Thrust — a move that breaks a 4-bar extreme, flipping flow and setting a swing.
- Swing high / low — the extreme held when flow last flipped.
- BOS (break of structure) — price breaks a confirmed swing in the trend direction: continuation.
- CHOCH (change of character) — price breaks a swing against the trend: potential reversal.
- Wick FVG / fair value — a 3-candle imbalance; the fair-value zone price tends to revisit.
- Dealing range — the current swing high→low span; dealing-range % is where price sits within it.
- Daily stalk zones — the upper/lower zones off the prior daily range where setups are stalked (
D.STK). - D.MTX / S.MTX — the daily and swing "matrix" level read-outs (% position with fair/unfair and deep-retracement flags).
- Daily levels — projections off the prior day: 150 / 125 / 100 / 67 / 50 / 33 / 0 / −25 / −50.
- Mx — the monthly boundary: the 1st of the month, and the monthly options expiry (3rd Friday, rolling back to Thursday on a holiday). Quad-witching in Mar/Jun/Sep/Dec.
- Sessions — the 19:45 evening open, the overnight range, and RTH 09:30–16:00.
Web App Features
- Instance strip — one card per live EA, grouped by client (account). Collapse a client; each symbol shows an online dot, trend, dealing-range %, P&L and an ARMED flag.
- Engine cards — M15 / H4 / M5 structure, risk for the next order, account, exposure.
- Session game plan — bias, max trades, max session loss, min dealing range, window, allowed thesis buckets, require-H4-agreement. Set before, enforced during.
- Entry patterns — the buckets and tiles; a tile is clickable only when the EA reports it available.
- Trade controls — risk / SL / R:R / split presets, hidden orders, arm, and a gated Execute (off unless
InpAllowRemoteExec). Set-SL / Set-TP take a price; the matrices stay chart-only. - Open positions (Trade tab) — every ticket on the account, merged across instances, with a per-row Close addressed to the owning chart.
- Journal — the table above.
- EA source / updater card — download the EA, template, and updater; generate a client config with a per-client EA name.
Phone App (PWA)
Open 7r4d3.net in Chrome and Install app (or the Install button in the header). It lands on
your home screen, opens full-screen, and can push alerts even when closed.
- 🔔 Alerts — tap once, grant permission; a test push confirms it. Alerts fan out to every subscribed device.
- Control — all trade controls, per-ticket close and the journal work on the phone; wide tables scroll inside their own container so the page never scrolls sideways.
- Tapping a notification jumps the dashboard to the instance it was about.
Web Push is implemented from node:crypto alone (RFC 8291 payload encryption + RFC 8292 VAPID),
so the bridge stays zero-dependency.
POST /api/alert hook that reaches the phone is live and tested; the EA needs a one-line call added
next to SendDiscordAlert to use it.The Updater
- Pulls the current EA from the bridge, installs into the terminal's
Experts, compiles it, backs up and rolls back on a bad build. - Windowed (
Update-EA-GUI.bat) and console (Update-EA.bat) — same worker. - Per-client EA name — the filename MT5 (and the broker's journal) sees. Set it in the window or the config.
- Diagnose — one button, a full support report: config, token length, DNS, TCP, proxy, unauthenticated then authenticated calls. The first failing line is the fault.
- Self-maintaining — updates itself and syncs the GUI/companion files each run.
Infrastructure
- Host — Railway runs the Node server with a mounted
/datavolume (journal, plan, VAPID key, push subscriptions all persist). - Domain —
7r4d3.net, a Cloudflare-proxied CNAME to Railway. It exists because a client's network dropped TCP to Railway's IP; Cloudflare's IPs are reachable. The Railway URL still works as a fallback. - Auth — every
/api/*route needs theRM_TOKEN, except/api/healthand/api/push/key(neither is a secret). - Master account —
RM_MASTER_LOGIN(a service env var) names the account whose EAs fill the shared market journal. There is no single master EA; the master is an account running one EA per symbol chart, and only its instances write shared observations. Unset = any EA writes (fine for one user)./api/healthreportsmasterLoginso you can confirm it took. - Versioning —
RM_VERSIONdrives both the EA and the properties dialog; the server'sCONTRACT_VERSIONis bumped with it so a stale EA can't masquerade as current.
Execution Footprint
Measures to keep automated trading from reading as automated. Full audit in EXECUTION-FOOTPRINT.md.
- Magic number 0 — indistinguishable from a manual order; no cross-account handle.
- Risk jitter — the risk figure jitters down by up to
InpRiskJitterPctper setup, so the same setup no longer produces a byte-identical lot size. - Stagger — split legs are queued and sent 200–2000 ms apart (off
OnTimer, never blocking the protective paths), so a split doesn't arrive as N tickets in the same millisecond. - Per-client EA name — removes the filename as a handle linking accounts.
- Local-only logging — the Experts-log banner is opt-in (
InpDebugLog); the on-chart badge verifies the build without writing anything.
To Define / In Progress
The living list — ambiguities to resolve and work queued. This is the place to catch mis-defined things.
POST /api/alert call so phone alerts fire, not just Discord.