Gap Closure Implementation Plan
Objective
Transform Certio from a “One-Way Fire & Forget” system into a “Two-Way Command & Control” platform, achieving feature parity with TradersPost’s dashboard capabilities while maintaining our specific advantage in the MT4/Prop Firm space.Core Features (The “Controller” Dashboard)
- Live Position Tracking (Two-Way Sync): Dashboard shows real-time open positions, PnL, and Equity from the MT4 terminal.
- Remote Trade Management: User can click “Close” or “Flatten All” in the Dashboard, which triggers execution on the MT4 terminal.
Phase 1: The “Live state” (Two-Way Sync)
1.1 Client Side (MQL4/5 Bridge)
- Action: Implement
SendSnapshot()function. - Logic: Every 5 seconds (and immediately on Order changes), scan all open orders.
- Payload:
- Transport: HTTP POST to
/api/v1/sync.
1.2 Backend (Ingress & Redis)
- New Endpoint:
POST /api/v1/sync(Authenticated). - Storage: Use Redis Hashes for instant access.
HSET user:{secret}:state equity 10050.50SET user:{secret}:positions <JSON_BLOB>
- API for Frontend:
GET /api/v1/statereturns the latest cached snapshot.
1.3 Frontend (Dashboard UI)
- New Component:
PositionTable.tsx. - New Widget:
AccountStats.tsx(Live Equity/Balance). - Data Fetching: Poll
/api/v1/stateevery 3s (or use SWR).
Phase 2: The “Remote Control” (Action Actions)
2.1 Backend (Ingress)
- New Endpoint:
POST /api/v1/command. - Request:
{"command": "CLOSE", "ticket": 123}or{"command": "FLATTEN"}. - Logic: Push command to a high-priority Redis Queue:
commands:{secret}.
2.2 Client Side (MQL Bridge)
- Logic: The existing worker (
Certio_Worker) is already polling. We modify the response of the poll to include “System Commands” alongside “Trade Signals”. - Execution:
if (command == "CLOSE") OrderClose(ticket)...if (command == "FLATTEN") CloseAll()...
2.3 Frontend (Dashboard UI)
- UI Update: Add “Red X” (Close) button to
PositionTable. - UI Update: Add “Panic Button” (Flatten All) to the header.
Execution Order
- Backend Extensions (Go): Define structs, endpoints, and Redis schema.
- MQL Upgrade: Modify
Certio_Worker.mq4/5to send snapshots and handle Close commands. - Frontend Build: Create the new UI components to visualize functionality.
Verification
- Success: I open a trade manually in MT4 -> It appears on Dashboard (Sync).
- Success: I click “Close” on Dashboard -> MT4 closes the trade (Control).