
How I automated my gold trading analysis (step by step)
How I automated my gold trading analysis (step by step)
I trade XAUUSD (gold against the US dollar) on ThinkMarkets, using MT5 on mobile. My session is 18:00-19:00 SAST — the US session open, when gold moves the most.
Before automation, I did everything manually: checked the price, looked up S/R levels, scanned the news, calculated position size, and logged trades after the session. It took 20-30 minutes of preparation and another 10 minutes of post-session logging.
Now the agent handles the prep, the logging, and the risk enforcement. Here's how it was built — one piece at a time.
Step 1: The trading profile
Before automating anything, I documented the entire trading approach in a profile:
- Instrument: XAUUSD only (gold is what I know)
- Session: 18:00-19:00 SAST (US open)
- Strategy: Support/resistance levels + momentum continuation
- Timeframes: H4 for bias → M15 for entry → M5 for precision
- Risk: 1-2% per trade, max 2 trades per session, 3% daily loss limit
- Targets: TP1 at 1:1.5 R&R, TP2 at 2:1
- Goals: >55% win rate, ≥1.5:1 average R&R, 3-8% monthly ROI
This profile became the foundation for everything that followed. You can't automate what you haven't defined.
Step 2: Morning briefing (Day 1)
The first automated tool was a morning briefing that runs daily at 15:00 SAST — before the trading session opens.
It fetches:
- Live gold price from gold-api.com (with fallback to metals.live and investing.com)
- Key support and resistance levels
- Economic calendar events that could affect gold
- A pre-session checklist (what to watch, what to avoid)
From zero to a working morning briefing on Day 1. It was the first cron job I ever deployed.
Step 3: Evening recap (Day 1)
Built on the same day — an evening recap at 20:00 SAST, right after the session closes.
It summarizes:
- What happened during the US session
- How price interacted with the key levels
- What the setup was (or wasn't)
- Outlook for the next day
This created a feedback loop: morning briefing sets the plan, evening recap reviews what happened. But there was still a gap — no way to log the actual trades.
Step 4: Trade journal (Night 3 — built by the nightly ideas agent)
The agent noticed we had analysis automation but no trade logging. It built a complete trade journal:
- Add trades with instrument, direction, entry, stop-loss, take-profit, result
- Stats calculation: win rate, average R&R, total and daily P&L, streak, max drawdown
- Data storage in JSON at
~/.hermes/xauusd_journal/trades.json - Daily prompt at 19:15 — right after the session — asking me to log the day's trades
This created the missing feedback loop. Now I can see if my actual results match my targets.
Step 5: Session prep pinger (Night 4 — built by the nightly ideas agent)
The morning briefing looks at yesterday's data. I needed something that runs right before the session with live, current data.
The session prep pinger runs at 17:45 — 15 minutes before 18:00. It:
- Fetches live gold price from 3 sources
- Loads the day's S/R levels from the morning briefing's output
- Checks the economic calendar for any events in the next hour
- Outputs a concise checklist: bias, key levels, what to watch, what to avoid
First test run: fetched gold at $4,541.20, loaded levels correctly, output clean checklist. Working.
Step 6: Risk calculator (Night 5 — built by the nightly ideas agent)
Having risk rules documented is one thing. Having a tool that enforces them before you enter a trade is another.
The risk calculator:
- Takes account balance, risk percentage, and stop-loss distance
- Calculates position size in ounces
- Enforces the 3% daily loss limit
- Enforces max 2 trades per session
- Enforces minimum 1:5:1 R&R
- Reads S/R levels from the morning briefing's daily output
- Auto-resets daily state at midnight
If a trade doesn't meet the criteria, it tells you why. Before you enter, not after.
What the full workflow looks like now
15:00 — Morning briefing arrives in Discord. I review the plan.
17:45 — Session prep pinger arrives. Live price, S/R levels, checklist. I'm ready.
18:00-19:00 — I trade. The agent doesn't trade for me — I make the decisions. But I'm working from a prepared plan, not doing analysis on the fly.
19:15 — Trade journal prompt arrives. I log the session's trades.
20:00 — Morning recap arrives. Reviews what happened vs what was planned.
Next morning — I have data. Win rate, R&R, P&L, streaks. I can see if I'm hitting my targets.
What's still manual
I still make the actual trading decisions. The agent prepares, calculates, and logs — but doesn't enter or manage trades. That's a deliberate choice. The discretionary judgment of when to enter, when to wait, and when to walk away is the part I trust myself with.
The next phase (Phase 2, months 2-4) includes semi-automated signal detection — S/R scanners, momentum candle detection, and breakout alerts. But live automated execution is Phase 4 (MQL5 expert advisor), and that's a long way off.
The real lesson
Automating trading isn't about replacing the trader. It's about removing everything around the decision that isn't the decision itself. Analysis, preparation, risk calculation, logging, performance tracking — all of that can and should be automated.
What remains is the part that requires human judgment: reading the price action, managing the trade, knowing when the plan has changed.
That's the part worth spending your mental energy on.
Trading profile, strategy, and automation tools documented in the Obsidian vault. Win rate and performance targets are tracked in the automated trade journal. Nothing in this post is hypothetical — every tool described here is running on the live system.
Akhil Pillay
Agentic Systems Architect & AI Advocate
This post was written by Jarvis — Akhil's Hermes AI agent — and vetted by Akhil before publishing.
Enjoyed this? Join the community for more AI agent insights.