Overview
PHANTOM-MNQ is a 10-agent AI execution system for MNQ futures. When the Iron Sight Pine Script strategy detects the 8AM range sweep on a 5-minute MNQ chart, it fires a webhook alert to NIGHTHAWK on the GCP VM. NIGHTHAWK logs the signal to SENTINEL (PostgreSQL) and forwards it to PHANTOM-MNQ, which fans the signal to 10 independent AI agents. Each agent scores the signal with an LSTM model and a Claude verdict. If 6 or more agents return CONFIRM, the quorum is met and the Bridge Service on the Windows home machine fires a bracket order to NinjaTrader 8 via TCP ATI, routing through Tradovate to the Apex Trader Funding eval account.
The system is intentionally split across three environments.
TradingView detects and alerts — it does not execute
(autoExec = OFF).
GCP runs the always-on server stack: webhook ingestion, signal logging, and the AI quorum.
The Windows home machine runs the Bridge and NinjaTrader 8 — NT8's ATI is a
local TCP server on localhost:36973
that cannot be reached from the internet. A Cloudflare Tunnel bridges the GCP executor to the Windows Bridge securely.
Interactive Brokers paper trading runs in parallel on GCP as a separate training-data layer — it is not the Apex execution path.
Infrastructure Zones
Signal Flow
8AM range forms on MNQ1! 5-minute chart. Price sweeps the low (BUY) or high (SELL). Macro filter passes (range expansion check). BUY or SELL condition evaluates true on bar close.
Validates TV_SECRET. Detects MNQ signal via ticker.includes('MNQ') or model_id.includes('MNQ'). Writes raw signal to SENTINEL. Forwards to PHANTOM on 127.0.0.1:8081.
Writes immutable row to signals_processed. Every signal is logged regardless of what the AI decides. quorum_count and bridge_status columns are updated after quorum resolves.
asyncio.gather() runs all 10 agent pipelines concurrently. Each agent independently: scores the signal with its LSTM model, passes through the gatekeeper (regime / risk gate), then calls Claude for a verdict.
Counts claude_verdict == "CONFIRM" across all 10 results. Threshold: 6 / 10. OVERRIDE and HOLD do not count. Result: SENT / SKIPPED / FAILED.
PHANTOM's executor POSTs to https://phantom-bridge.S-3.us/execute via Cloudflare Tunnel. Bridge validates X-Bridge-Secret header. Fails closed (503) if NT8 is unreachable.
Opens TCP socket to localhost:36973. Sends 3 commands in sequence: MARKET entry, then STOP MARKET SL and LIMIT TP cross-linked as OCO. NT8 auto-cancels the surviving order when one fills.
NinjaTrader 8 processes the ATI commands, submits the bracket order via Tradovate to APEX6056270000001. SENTINEL records final bridge_status = 'SENT' and quorum_count.
Iron Sight — TradingView Cloud
| Property | Detail |
|---|---|
| Role | Detects the 8AM range sweep setup on MNQ1! 5-minute chart and fires webhook alerts |
| Script | TRNQL_8AMsweep.v3 — Pine Script v6, strategy() declaration |
| Input | MNQ1! OHLCV real-time data (TradingView feed) |
| Output | JSON webhook POST to NIGHTHAWK /webhook |
| Key detail | autoExec = OFF — the strategy does not place orders natively via Tradovate. It fires alerts only. PHANTOM controls execution. |
| Macro filter | Layer 2 rolling range expansion filter suppresses signals on abnormal range days. todayRange > rangeExpMult × rollingAvg |
| Zone | TradingView Cloud |
NIGHTHAWK — GCP VM
| Property | Detail |
|---|---|
| Role | Public webhook endpoint — signal ingestion, validation, logging, and PHANTOM forwarding |
| Runtime | Node.js / Express.js, PM2 process manager, GCP VM port 8080 |
| Input | TradingView POST /webhook with TV_SECRET in body |
| Output | DB write to SENTINEL + HTTP forward to PHANTOM 127.0.0.1:8081 |
| MNQ detection | Matches ticker.includes('MNQ') or model_id.includes('MNQ'). Non-MNQ signals are logged only, not forwarded. |
| Resilience | PHANTOM forward errors are caught and logged — a PHANTOM outage does not cause a 500 back to TradingView. Webhook always returns 200 after SENTINEL write. |
| Zone | GCP VM |
SENTINEL — GCP VM
| Property | Detail |
|---|---|
| Role | Immutable signal audit log — every signal recorded regardless of AI decision or execution outcome |
| Runtime | PostgreSQL sentinel_db, 127.0.0.1:5432, GCP VM |
| Key table | signals_processed — per-agent results, quorum_count, bridge_status (SENT / SKIPPED / FAILED) |
| Other tables | models — registered strategies | council_state — REAPER daily risk report | agent_accounts, pnl_history |
| Audit use | Query bridge_status to measure quorum hit rate and bridge reliability over time. |
| Zone | GCP VM |
PHANTOM Engine — GCP VM
| Property | Detail |
|---|---|
| Role | 10-agent AI quorum — the decision layer between signal ingestion and order execution |
| Runtime | Python 3.11 / FastAPI, PM2 process, GCP VM port 8081 |
| Agent pipeline | LSTM model score → gatekeeper (risk/regime gate) → Claude claude-sonnet-4-6 verdict |
| Quorum rule | claude_verdict == "CONFIRM" counts. OVERRIDE and HOLD do not count. Threshold: 6 / 10. |
| REAPER agent | Runs daily at 21:00 UTC. Evaluates session performance, writes to council_state. Can halt trading for the session. |
| IB parallel layer | IB Gateway (paper, port 4002) runs alongside PHANTOM as a training data layer. It is not the Apex execution path. |
| Zone | GCP VM — PHANTOM |
Quorum Visualiser — Example: 7/10 CONFIRM
Bridge Service — Windows Home Machine
| Property | Detail |
|---|---|
| Role | Translates PHANTOM execution requests into NT8 ATI TCP bracket commands |
| Runtime | Python / Flask, Windows home machine, port 8082 |
| Reachable via | Cloudflare Tunnel — phantom-bridge.S-3.us → localhost:8082 |
| Auth | X-Bridge-Secret header — shared secret between PHANTOM executor and Bridge |
| OCO linking | SL command references TP order ID in OCO field. TP command references SL order ID. NT8 auto-cancels the other when one fills. |
| Fail-closed | Returns 503 if NT8 ATI is unreachable. PHANTOM logs bridge_status = 'FAILED'. No silent failures. |
| Zone | Windows Home Machine |
ATI Bracket Command Format
PLACE;APEX6056270000001;MNQ 09-26;BUY;1;MARKET;GTC;0;0;0;PHANTOM_<id>;; ← entry PLACE;APEX6056270000001;MNQ 09-26;SELL;1;STOP MARKET;GTC;0;19975.00;0;PHANTOM_<id>_SL;PHANTOM_<id>_TP; ← SL (OCO→TP) PLACE;APEX6056270000001;MNQ 09-26;SELL;1;LIMIT;GTC;20100.00;0;0;PHANTOM_<id>_TP;PHANTOM_<id>_SL; ← TP (OCO→SL)
NT8 / Apex — Windows Home Machine
| Property | Detail |
|---|---|
| Role | Order execution endpoint — routes bracket order to Apex Trader Funding eval account via Tradovate |
| Runtime | NinjaTrader 8, Windows home machine. ATI server: TCP localhost:36973 |
| Account | APEX6056270000001 — Apex Trader Funding $50K eval account |
| Contract | MNQ 09-26 — Micro E-mini Nasdaq September 2026 |
| Pre-session | NT8 must be open with ATI enabled before each trading session. Bridge /health endpoint confirms NT8 reachability. If nt8_reachable: false, do not trade via PHANTOM. |
| Zone | Windows Home Machine → Apex |
Infrastructure Map
| Property | Value |
|---|---|
| Name | project-black-box-vm |
| Zone | us-east4-b |
| Machine | e2-small, Debian 12 (Bookworm) |
| SSH user | vcwor (gcloud compute ssh) |
| Process mgr | PM2 (run as neo) |
| PM2 processes |
online
NIGHTHAWK :8080online
PHANTOM-MNQ :8081online
IB_GATEWAY :4002online
NOVNC / X11VNC |
| Database | sentinel_db — PostgreSQL 127.0.0.1:5432 |
| App files | /home/neo/phantom_mnq/ |
| Venv | /home/neo/phantom_venv/ |
| Property | Value |
|---|---|
| Bridge port | 8082 (Flask) |
| CF tunnel | phantom-bridge.S-3.us |
| NT8 ATI port | localhost:36973 (TCP) |
| Apex account | APEX6056270000001 |
| MNQ contract | MNQ 09-26 |
| Bridge files | bridge/bridge.py + config.env |
| Health check | GET /health → nt8_reachable: true |
| Property | Value |
|---|---|
| Strategy | TRNQL_8AMsweep.v3 |
| Chart | MNQ1! 5-minute |
| Webhook secret | TV_SECRET |
| model_id | TRNQL_8AMsweep.v3 |
| autoExec | OFF — execution via PHANTOM only |