Series · Completed
AI Trading · Building a Complete Trading System
Working with AI agents to plan, test and run a trading system on a demo account, from the first prompt to the capstone.
- 1AI agents for traders: what to delegate and what to keep
An AI agent can write code, read reports and do the arithmetic. It cannot see the next candle. One rule and a four-level ladder for what to hand over.
- 2Choosing an AI agent: prices, privacy and a 14-day trial
Pick one AI tool to start with by budget, machine and privacy, then keep or drop it after 14 days using questions with known answers.
- 3Using AI chat safely: privacy first, then four everyday tasks
Before installing anything: switch off training, clean what you paste, and use free AI chat to explain, describe charts, summarise and check lot sizes.
- 4Preparing your machine for an AI agent: terminal, Git, Python
Before installing an agent: the right terminal, Git checkpoints, a folder where secrets cannot leak, Python 3.14 in a venv and a readiness check.
- 5Installing Claude Code step by step: CLI and desktop
Install Claude Code, log in on your plan instead of paying API rates, block .env reads, and run a first session: Plan, review, Manual, test, commit.
- 6Installing Codex CLI, Antigravity CLI, Cursor or Copilot safely
Four routes to a coding agent, each with the right login, the lowest-permission first session, a spending cap and an EMA task with a known answer.
- 7The five-part prompt for traders: role, data, limits, output, check
A prompt frame that keeps the model on your data: a time lock, a source for every number, two conditional scenarios and a self-check, run three times.
- 8A prompt library for traders: nine cards with safety labels
Nine versioned prompt cards for charts, news, journals, specs, Pine, MQL5, backtests, calendars and stress tests, each labelled by what a mistake can touch.
- 9AGENTS.md, CLAUDE.md, skills and subagents for a trading project
Write the rules once for every agent session: one AGENTS.md, a one-line CLAUDE.md, a journal skill, two read-only reviewers, and deny rules for the hard limits.
- 10Ten rules and a five-step loop for working with an agent
Explore, plan, build, check and commit, then an independent review: run the full loop on a round-down lot function with five tests, and read the diff yourself.
- 11Keys, spend caps and prompt injection: securing a trading agent
Keep keys out of code and chat, cap API spend, treat news as hostile data, and put a code check between any agent and an order. Then attack it yourself.
- 12Vetting an MCP server, skill or repo before you install it
Anything you install for an agent runs with your rights. Four questions with evidence, three gates, a read-only vetting profile and a scanner for install lines.
- 13Connecting an agent to market data with MCP, read-only
Give the agent real candles instead of screenshots: connect MCP data servers, make write tools ask and order tools disappear, then check five candles yourself.
- 14Reading an MT5 demo from Python without being able to send orders
Log in with the investor password, save 500 closed H1 candles to CSV, size the lot from the broker's own spec, and run order_check without sending anything.
- 15A trading day with an agent: morning report, checklist, review
Code computes the levels, the agent writes a four-part morning report, a check gate blocks bad drafts before Telegram, and every skipped trade gets logged.
- 16Luck or skill: how many trades before you trust a result
Base rates, standard errors, 95% intervals and multiple testing, with a tested stats library to check a pretty agent or backtest result.
- 17Shadow mode: test an agent's decisions before it proposes trades
Run an agent in shadow on post-cutoff data: fixed JSON checked by code, a baseline rule to compare, repeat runs, and a Brier score for its confidence.
- 18From agent proposal to MT5 demo order: checks, approval, kill switch
A level-2 flow on demo: ten code checks, approval over Telegram, one file that calls order_send, a four-layer kill switch, and seven drills.
- 19Agent cost, retries and drift: a budget, a cache and a weekly check
Price an agent loop before it runs, order the prompt so the cache hits, retry with limits, log every decision and spot drift with a weekly table.
- 20Capstone: two weeks of shadow trading with an AI agent
Assemble everything into a personal assistant you can rerun, trace and stop: two weeks of shadow points, nightly rechecks, drills and a graded file.
- 21Write a method spec before an agent touches a chart
Turn a trading method into an 11-part spec, code the answer key with nine tests, then let an agent score each condition and grade it field by field.
- 22Backtest a method spec in Python with costs and a holdout
Run the XAU-01 spec through backtesting.py with spread, slippage and commission, check indicators against TA-Lib, then open the holdout once.
- 23A read-only gold setup scanner with tickets you approve by hand
Scan XAU-05 and XAU-10 from an MT5 demo with no order function, write tickets with lots rounded down, and place every demo order yourself.
- 24Checking an agent's gold signals against a backtest ledger
Compare an agent's XAU-06 signals with a backtest ledger over ten days that span both DST changes, and give every mismatch a cause.
- 25Judgment-heavy methods with an agent: code scans, agent annotates
Split a method's checklist into numeric lines code checks and judgment lines you decide; code finds candidates, the agent only writes evidence.
- 26Claude and Codex as coding assistants: a first task you can check
Set up a separate practice folder, let the assistant read before it writes, and accept its first function only with a test against hand-worked numbers.
- 27From "buy the breakout" to a spec a machine can check
Turn a trading idea into true/false conditions on closed candles, with entry, SL, costs and skip cases written out, before anyone writes a bot.
- 28A prompt with acceptance criteria: one small task, proven by a test
Give the AI one sizing function with units, limits, an expected test case and a refusal case, then ask it to point at the lines and the test results.
- 29TradingView indicator or strategy: signal, order and fill are not one
Write an SMA-cross indicator, check a few candles by hand in the Data Window, then build a strategy with costs, SL and TP, and compare its trade list.
- 30Replay, Strategy Tester and Paper Trading answer different questions
Trace one BTC H1 event through a Replay screenshot, a Tester trade and a paper fill, and log signal, alert and receive times before any demo EA.
- 31A first MT5 Expert Advisor that only logs closed bars
Compile an EA that writes one line per closed bar and sends nothing, check 20 bars for duplicates and gaps, and see why renaming a file isn't an MT4 port.
- 32Reading a backtest report against its trade ledger
Rebuild trade count, net R, fees and drawdown from the trade list, hand-check a few trades, and drop any AI claim that doesn't trace back to a row.
- 33Tuning parameters without using up the test period
Write a small grid first, split by time into train, validation and test, log every run, lock the choice, and open the test period exactly once.
- 34A Telegram bot that only sends demo reports
Create a send-only bot, keep its token out of prompts and code, read ok and description on every send, and never report a fill the demo didn't confirm.
- 35A TradingView webhook receiver that only notifies
Check JSON, symbol, age, a receiver code and event_id, answer within 3 seconds, then tell Telegram; duplicates and restarts never announce an event twice.
- 36A demo-only MT5 EA that fails closed
Gate every demo request on account mode, symbol, quote, stops, volume and event ID, run OrderCheck first, and log checked, sent and filled as three events.
- 37Reconciling demo events from MT5 candle to Telegram
Join the EA log, the MT5 deals and the Telegram log by event_id over at least 10 signals, including refusals, a duplicate and an unknown state.
- 38When was it known? Pivots, back-plots and release times
A marker drawn on an old candle may only be known bars later. Test it on cut data, join macro figures by release time, and check regressions on returns.
- 39kNN for traders: only neighbours whose labels are finished
Compute L1 distances by hand, drop past bars whose outcome wasn't known yet, fit the scaler on train only, and compare against plain baselines.
- 40Walk-forward with purging: labels that cross the boundary
Split by time, purge train samples whose label reaches into the test, fit only on train, report every fold, and see how shuffling and cherry-picking lie.
- 41Is that AI indicator learning, or just smoothing?
Find the features, labels, loss, training loop and weights, spike-test a smooth line, and keep forecasts in a ledger that can't be quietly rewritten.
- 42A health report for a demo system: stale data isn't drift
Write thresholds first for quote age, spread, gaps, duplicates and unknown orders; block entries on operational faults and only flag drift for review.
- 43Capstone: ML against a baseline, ablation and shadow mode
Run a baseline and each ablation on the same folds and costs, count every try, shadow the decisions without orders and hand in a six-file dossier.