Rule-based entry
An eligible setup produced by the completed-candle engine can proceed without an LLM call, subject to every account, exposure and broker preflight.
05 Gold market intelligence system · 2026
An automated gold-market scanner that turns live MetaTrader data into rule-based setups, optionally adds bounded AI review, and revalidates every authorized plan before protected broker submission.
Operational interface
Live scanning, authorization and protection
How it works
From market snapshot to protected orderTradew separates market detection, authorization and broker execution. A signal can be useful without automatically becoming an order, and every stage can stop the pipeline with a visible reason.
The Python service reads XAU quotes, account state, open exposure and completed candles from MetaTrader 5 across M1, M5, M15, M30, H1, H4 and D1.
Confirmed pivots, supply and demand zones, ATR, breakouts, retests, pullbacks, sweeps and rejection patterns are evaluated from completed candles—without using future chart information.
Deterministic mode uses the rule-based plan directly. Independent mode lets one blind LLM propose a bounded native-limit plan. Consensus requires the deterministic direction and both AI assessments to agree.
Before submission, deterministic code checks snapshot freshness, account identity, gold exposure, spread, margin, stop geometry, reward/risk, broker distances, duplicate setups and automation pause state.
Approved entries use native MT5 limits with broker-side stops, targets and expiry. TP1 and runner positions, pending-order cancellation, break-even, trailing, phone alerts and append-only audit evidence continue after submission.
Authorization modes
Runtime control over how entries are approvedThe operator chooses the authorization policy from the dashboard. Switching modes changes who may originate or approve a plan; it never removes the deterministic broker and risk checks around submission.
The selected AI provider—Gemini or GPT-6 Astra High—receives a bounded, redacted market summary and has no MetaTrader tool, account identity or direct execution authority.
An eligible setup produced by the completed-candle engine can proceed without an LLM call, subject to every account, exposure and broker preflight.
One selected model creates its own BUY_LIMIT or SELL_LIMIT thesis from candles and levels. Deterministic code validates or rejects the complete plan.
The deterministic direction, informed review and blind independent read must agree. WAIT, WATCH or a changed plan cannot authorize submission.
Execution and safety
The model never sends the orderThe execution controller is isolated from analysis. It accepts only a current, fully specified plan and returns a concrete submitted, rejected or not-submitted reason to the interface.
Tradew checks all discovered gold positions and pending orders, account mode, available margin, executable quotes and broker constraints immediately before sending.
Entries carry broker-side stop-loss, structural objective and expiration. Three ladder levels share one risk budget rather than multiplying the intended exposure.
Broker-valid volume is divided as closely as possible into a 65% TP1 child and 35% runner. The runner can trail only after TP1 has traded.
Automatic management can reduce risk, move to cost-adjusted break-even and trail behind confirmed M5 structure. It never widens a stop or auto-closes exposure.
Setup references, one-submission rules, SQLite state and append-only decision records prevent duplicate actions and preserve the evidence behind each outcome.
Pausing blocks new AI jobs and entries while scanning, pending-order supervision, alerts and enabled protection for existing exposure continue running.
Technology and architecture
Full-stack local operations platformThe browser is the control surface. Python owns scanning and validation, MetaTrader owns market and broker interaction, and isolated adapters handle optional AI and notifications.
Continuously refreshed dashboard, settings, authorization controls, evidence panels and responsive mobile views.
Serialized scans, setup evaluation, decision contracts, execution queues, status endpoints and audit coordination.
Symbol discovery, seven-timeframe candles, quotes, exposure, broker calculations, pending orders and protected submission.
Transactional setup state, ticket bindings and outcomes with append-only decisions, reviews and replay evidence.
Selectable, single-flight AI adapters using a strict JSON schema, redacted input and no direct execution tools.
Private, deduplicated phone notifications when a clean deterministic setup first becomes BUY or SELL.
Production setup rules replayed over historical multi-timeframe data with modeled spread, costs, slippage and conservative fills.
Rotating compressed evidence logs with optional verified remote archival and visible storage health.
Delivered system
Research implementation with explicit limitsThe result is a working end-to-end platform for continuous scanning, explainable setup evidence, selectable authorization, broker preflight, protected execution, phone alerts, audit history and conservative replay. It is research software—not a claim of profitable trading performance.
Case studies / 05