← Library
PHANTOM

Signal Execution Architecture

Project Black-Box — Iron Sight → NIGHTHAWK → AI Quorum → NT8 ATI — S3 Development

GCP + Windows + Cloudflare

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.

☁ TradingView Cloud
TRNQL_8AMsweep.v3 Pine Script v6 Strategy — autoExec OFF
Fires JSON webhook alert on BUY / SELL signal
▼ HTTPS webhook → GCP VM port 8080
⚙ GCP VM — project-black-box-vm (us-east4-b)
NIGHTHAWK Node.js / Express — :8080
SENTINEL PostgreSQL — :5432
PHANTOM-MNQ FastAPI — :8081 — 10 agents
IB Gateway Paper trading — :4002 (parallel)
▼ Cloudflare Tunnel — phantom-bridge.S-3.us
🖥 Windows Home Machine
Bridge Service Flask — :8082
NT8 ATI Server TCP — localhost:36973
Tradovate → Apex Eval APEX6056270000001
Step-by-step: from the moment Iron Sight fires to NT8 submitting the bracket order.
1
Iron Sight Sweep Detected

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.

Fires → POST /webhook  {action, price, sl, tp, range_high, range_low, sweep_direction, model_id}
2
NIGHTHAWK Receives & Validates

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.

Forwards → POST :8081/signal  {action, price, sl, tp, fvg_size, sweep_direction, ...}
3
SENTINEL Logs Signal

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.

Persists → signal_id, action, price, sl, tp, timestamp
4
PHANTOM Fans to 10 Agents

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.

Each agent returns → PipelineResult{agent_id, outcome, claude_verdict, lstm_score}
5
PHANTOM Quorum Evaluation

Counts claude_verdict == "CONFIRM" across all 10 results. Threshold: 6 / 10. OVERRIDE and HOLD do not count. Result: SENT / SKIPPED / FAILED.

If CONFIRM ≥ 6 → calls executor.execute(signal_id, action, sl, tp, quorum_count)
6
Bridge Receives Execution Request

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.

Authenticates → {signal_id, action, contracts, sl, tp, quorum_count}
7
Bridge Sends ATI Bracket to NT8

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.

Sends → 3× PLACE commands via sendall()  |  returns order_id to PHANTOM
8
NT8 → Apex Order Submission

NinjaTrader 8 processes the ATI commands, submits the bracket order via Tradovate to APEX6056270000001. SENTINEL records final bridge_status = 'SENT' and quorum_count.

Result → OCO bracket live on Apex eval account

PropertyDetail
RoleDetects the 8AM range sweep setup on MNQ1! 5-minute chart and fires webhook alerts
ScriptTRNQL_8AMsweep.v3 — Pine Script v6, strategy() declaration
InputMNQ1! OHLCV real-time data (TradingView feed)
OutputJSON webhook POST to NIGHTHAWK /webhook
Key detailautoExec = OFF — the strategy does not place orders natively via Tradovate. It fires alerts only. PHANTOM controls execution.
Macro filterLayer 2 rolling range expansion filter suppresses signals on abnormal range days. todayRange > rangeExpMult × rollingAvg
ZoneTradingView Cloud
PropertyDetail
RolePublic webhook endpoint — signal ingestion, validation, logging, and PHANTOM forwarding
RuntimeNode.js / Express.js, PM2 process manager, GCP VM port 8080
InputTradingView POST /webhook with TV_SECRET in body
OutputDB write to SENTINEL + HTTP forward to PHANTOM 127.0.0.1:8081
MNQ detectionMatches ticker.includes('MNQ') or model_id.includes('MNQ'). Non-MNQ signals are logged only, not forwarded.
ResiliencePHANTOM forward errors are caught and logged — a PHANTOM outage does not cause a 500 back to TradingView. Webhook always returns 200 after SENTINEL write.
ZoneGCP VM
PropertyDetail
RoleImmutable signal audit log — every signal recorded regardless of AI decision or execution outcome
RuntimePostgreSQL sentinel_db, 127.0.0.1:5432, GCP VM
Key tablesignals_processed — per-agent results, quorum_count, bridge_status (SENT / SKIPPED / FAILED)
Other tablesmodels — registered strategies  |  council_state — REAPER daily risk report  |  agent_accounts, pnl_history
Audit useQuery bridge_status to measure quorum hit rate and bridge reliability over time.
ZoneGCP VM
PropertyDetail
Role10-agent AI quorum — the decision layer between signal ingestion and order execution
RuntimePython 3.11 / FastAPI, PM2 process, GCP VM port 8081
Agent pipelineLSTM model score → gatekeeper (risk/regime gate) → Claude claude-sonnet-4-6 verdict
Quorum ruleclaude_verdict == "CONFIRM" counts. OVERRIDE and HOLD do not count. Threshold: 6 / 10.
REAPER agentRuns daily at 21:00 UTC. Evaluates session performance, writes to council_state. Can halt trading for the session.
IB parallel layerIB Gateway (paper, port 4002) runs alongside PHANTOM as a training data layer. It is not the Apex execution path.
ZoneGCP VM — PHANTOM

Quorum Visualiser — Example: 7/10 CONFIRM

CONFIRM (counts toward quorum) HOLD / OVERRIDE (does not count) 7 ≥ 6 threshold → QUORUM MET → Bridge fires
PropertyDetail
RoleTranslates PHANTOM execution requests into NT8 ATI TCP bracket commands
RuntimePython / Flask, Windows home machine, port 8082
Reachable viaCloudflare Tunnel — phantom-bridge.S-3.uslocalhost:8082
AuthX-Bridge-Secret header — shared secret between PHANTOM executor and Bridge
OCO linkingSL command references TP order ID in OCO field. TP command references SL order ID. NT8 auto-cancels the other when one fills.
Fail-closedReturns 503 if NT8 ATI is unreachable. PHANTOM logs bridge_status = 'FAILED'. No silent failures.
ZoneWindows Home Machine

ATI Bracket Command Format

NT8 ATI — 3-command OCO bracket (sent over TCP :36973)
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)
PropertyDetail
RoleOrder execution endpoint — routes bracket order to Apex Trader Funding eval account via Tradovate
RuntimeNinjaTrader 8, Windows home machine. ATI server: TCP localhost:36973
AccountAPEX6056270000001 — Apex Trader Funding $50K eval account
ContractMNQ 09-26 — Micro E-mini Nasdaq September 2026
Pre-sessionNT8 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.
ZoneWindows Home Machine → Apex

⚙ GCP VM
PropertyValue
Nameproject-black-box-vm
Zoneus-east4-b
Machinee2-small, Debian 12 (Bookworm)
SSH uservcwor (gcloud compute ssh)
Process mgrPM2 (run as neo)
PM2 processes
onlineNIGHTHAWK :8080
onlinePHANTOM-MNQ :8081
onlineIB_GATEWAY :4002
onlineNOVNC / X11VNC
Databasesentinel_db — PostgreSQL 127.0.0.1:5432
App files/home/neo/phantom_mnq/
Venv/home/neo/phantom_venv/
🖥 Windows Home Machine
PropertyValue
Bridge port8082 (Flask)
CF tunnelphantom-bridge.S-3.us
NT8 ATI portlocalhost:36973 (TCP)
Apex accountAPEX6056270000001
MNQ contractMNQ 09-26
Bridge filesbridge/bridge.py + config.env
Health checkGET /healthnt8_reachable: true
☁ TradingView
PropertyValue
StrategyTRNQL_8AMsweep.v3
ChartMNQ1! 5-minute
Webhook secretTV_SECRET
model_idTRNQL_8AMsweep.v3
autoExecOFF — execution via PHANTOM only