<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vince</title>
    <description>The latest articles on DEV Community by Vince (@vwsp).</description>
    <link>https://dev.to/vwsp</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4002201%2F7688d705-28f9-4b0a-95a7-4f9d6f4137e3.png</url>
      <title>DEV Community: Vince</title>
      <link>https://dev.to/vwsp</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vwsp"/>
    <language>en</language>
    <item>
      <title>Wiring AI agent into MetaTrader 5</title>
      <dc:creator>Vince</dc:creator>
      <pubDate>Thu, 25 Jun 2026 11:15:14 +0000</pubDate>
      <link>https://dev.to/vwsp/wiring-ai-agent-into-metatrader-5-4l7g</link>
      <guid>https://dev.to/vwsp/wiring-ai-agent-into-metatrader-5-4l7g</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally published on the &lt;a href="https://engineering.fintrixmarkets.com/posts/mt5-mcp-part-1/" rel="noopener noreferrer"&gt;Fintrix engineering blog&lt;/a&gt;. Part 1 of the &lt;a href="https://engineering.fintrixmarkets.com/series/trade-with-ai-agent/" rel="noopener noreferrer"&gt;Trade with AI agent&lt;/a&gt; series.&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ Everything here runs on a &lt;strong&gt;demo account&lt;/strong&gt;. This is engineering content, not financial advice. Trading CFDs is high-risk. Most retail accounts lose money. Read the disclaimer before you do anything with real funds.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;The majority of traders lose money even when using a good strategy due to the fact that they are humans.&lt;/p&gt;

&lt;p&gt;The easy part of trading (risk management) typically involves simply setting a limit to the amount of loss (for example: 1% risk on each trade). When a stop-loss order is activated, leave. Unfortunately, before you know it, there will be another potential opportunity staring at you and a quiet, nagging thought in the back of your head saying "just this time."&lt;/p&gt;

&lt;p&gt;Unfortunately most of the time, this will end badly. People who have tried to do a prop-firm challenge know where I'm going with this: if you break your own rules just one time, you'll end-up reading an e-mail from someone at a firm that starts off by stating "unfortunately...".&lt;/p&gt;

&lt;p&gt;The data has been saying the same thing for years:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;74–89% of retail CFD accounts lose money&lt;/strong&gt; — every quarter, across every broker. &lt;a href="https://www.esma.europa.eu/sites/default/files/library/esma71-98-128_press_release_product_intervention.pdf" rel="noopener noreferrer"&gt;The range ESMA found&lt;/a&gt; across providers when it imposed product-intervention measures, and the same range brokers still print in their risk disclosures today.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A good strategy (the one that has edge) can still blow up due to human emotions such as fear, greed, fatigue, or just the pure stupidity of chasing losses back aka the famous revenge trading. So usually the strategy is fine however, the human psychology is not especially for less experienced trader.&lt;/p&gt;

&lt;p&gt;Therefore, instead of focusing on trading strategies in this series, you will be handing off the method-execution (the rules/rule enforcement) and the screen watching to something that does not get fatigued, has no interest in "winning" its previous loss back, and does not get bored. Basically we're taking the emotional part off trading.&lt;/p&gt;

&lt;p&gt;You are going to hand it over to an Artificial Intelligence (AI) Trading Agent. Over the next few articles, we will be slowly building an autonomous AI trading agent that executes your strategy.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this series is
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Bring your own agent.&lt;/strong&gt; The same setup works across AI agents that supports MCP and the MCP registration maps cleanly to all of them. Pick whichever you already use:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Agent&lt;/th&gt;
&lt;th&gt;Open source&lt;/th&gt;
&lt;th&gt;Role here&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://openclaw.ai/" rel="noopener noreferrer"&gt;OpenClaw&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;The worked example throughout this post&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://hermes-agent.nousresearch.com/" rel="noopener noreferrer"&gt;Hermes&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;Nous Research's agent&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://chatgpt.com/codex/" rel="noopener noreferrer"&gt;Codex&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;OpenAI's coding agent&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.anthropic.com/product/claude-code" rel="noopener noreferrer"&gt;Claude Code&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;Anthropic's coding agent&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;It's &lt;strong&gt;broker-agnostic&lt;/strong&gt; — nothing here is tied to one broker — and it aims at the one corner nobody else bothered with: &lt;strong&gt;CFDs on &lt;a href="https://www.metatrader5.com/en" rel="noopener noreferrer"&gt;MetaTrader 5&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you are trading CFDs, then most likely you have used MetaTrader 5 as your trading platform. Millions of retail traders use MetaTrader 5, along with their professional desks and brokers. This widespread usage is what we are counting on – wire your agent in once and it will work with all brokers, instruments, and accounts supporting MT5.&lt;/p&gt;

&lt;p&gt;The agentic-trading wave is already here. On 27 May 2026, Robinhood shipped "&lt;a href="https://robinhood.com/us/en/agentic-trading/" rel="noopener noreferrer"&gt;Agentic Trading&lt;/a&gt;" — plug your own AI agent into a sandboxed account over MCP (&lt;a href="https://modelcontextprotocol.io/docs/getting-started/intro" rel="noopener noreferrer"&gt;Model Context Protocol&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;That alone is the evidence of this trend will be an established way of trading in the near future, rather than just a gimmick. However, it is limited to stocks, options, and cryptocurrencies. We left out the entire CFD/Forex community, which is home to a large segment of retail CFD traders. That is the segment that we would like to focus on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who this is for
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Seasoned CFD trader.&lt;/strong&gt; You know your strategy isn't the issue but discipline and psychology are. You want something that runs &lt;em&gt;your&lt;/em&gt; plan without affected by human limitations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Software engineer&lt;/strong&gt; who's been curious about trading but worry about not knowing the strategy. The agent does the trading heavy-lifting; you bring what you're good at, wiring up tools to make it perform better, it can even research profitable trading strategy for you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Grinding toward a funded prop account.&lt;/strong&gt; The agent holds the rulebook: it knows your exact remaining daily-loss room before every trade and can remind you or block your execution if you're about to breach your daily/weekly loss limit. What evaluators actually test "&lt;em&gt;do you know your numbers before every session?&lt;/em&gt;" becomes automatic.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why an agent, really
&lt;/h2&gt;

&lt;p&gt;Three honest reasons. None of them is "it prints money."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Time back.&lt;/strong&gt; Trading is &lt;em&gt;active searching&lt;/em&gt;. An agent flips it to &lt;em&gt;reactive reviewing&lt;/em&gt; — it pings you (WhatsApp, Telegram, SMS, a phone call) only when something's worth a decision or you can delegate it to trade automatically for high probabilty setup.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Trading today — &lt;em&gt;active searching&lt;/em&gt;
&lt;/th&gt;
&lt;th&gt;With an agent — &lt;em&gt;reactive reviewing&lt;/em&gt;
&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Stare at screens waiting for a setup&lt;/td&gt;
&lt;td&gt;It watches 24/7 and pings you when one appears&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Scan the news yourself&lt;/td&gt;
&lt;td&gt;It summarises only the news that moves your pairs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Redraw levels, track the chart&lt;/td&gt;
&lt;td&gt;It summarises what the chart is doing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Size each position by hand&lt;/td&gt;
&lt;td&gt;It sizes to your risk rule&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Chained to the desk&lt;/td&gt;
&lt;td&gt;Check in when it matters&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;2. No emotion.&lt;/strong&gt; No fear, no greed, no urge to revenge trad the morning's loss. It doesn't overtrade out of boredom or double up after three wins, it just runs the plan. For the prop crowd: it's common knowledge that revenge trading after the first loss kills more evaluations than anything else.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Fun again.&lt;/strong&gt; With the grind and the anxiety off your plate, what's left is the interesting part: strategy design, experimentation, "&lt;em&gt;what if I taught it this?&lt;/em&gt;" The craft, minus the cortisol.&lt;/p&gt;

&lt;p&gt;One honest warning:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;An agent that executes a bad plan calmly will lose money calmly.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It's still your strategy. Not a money machine, but a discipline-and-time machine. It makes a good trader's habits automatic and a beginner's first steps survivable. That's the whole promise.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we're building today
&lt;/h2&gt;

&lt;p&gt;By the time you finish this post (about ~15 minutes of configuration), your agent will have executed &lt;strong&gt;its first demo trade and closed it again&lt;/strong&gt; — a single round trip of one lot (0.01), buy and sell from your terminal. It is the simplest form which is actually useful, no risk models, no strategy, no news feeds yet. Your agent should be able to view your account &amp;amp; perform an action on it without risking anything. All other components from above diagram are scheduled for later posts.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You  →  OpenClaw  →  [ mt5-trading-mcp ]  →  MetaTrader 5
                      the piece we install      demo account
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;You can swap OpenClaw for Codex, Claude Code, Hermes, or whatever you're most comfortable with. The one piece we install today — &lt;code&gt;mt5-trading-mcp&lt;/code&gt; — is highlighted.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The one piece we install today is open source and not affiliated with Metaquotes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;mt5-trading-mcp&lt;/code&gt;&lt;/strong&gt;: the MCP server. It's what gives any compatible agent a safe set of tools to read your account and place orders, with an approval flow, notional caps, and price-drift checks baked in.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Later posts add &lt;strong&gt;&lt;code&gt;agent-trading-skills&lt;/code&gt;&lt;/strong&gt; (position sizing, risk rules, strategy recognition) on top of this same foundation — but today is deliberately just the round-trip.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The whole thing, end to end — about 40 seconds, on a demo account:&lt;/strong&gt; you ask OpenClaw to install &lt;code&gt;mt5-trading-mcp&lt;/code&gt; straight from its GitHub URL, it wires the server into itself, then runs the round-trip — balance → quote → BUY &lt;code&gt;0.01&lt;/code&gt; EURUSD.z → show the open position → close it → report realized P&amp;amp;L and the new balance.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx3m8uo6yyxma7cfbnuyz.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx3m8uo6yyxma7cfbnuyz.gif" alt="OpenClaw installs mt5-trading-mcp from its GitHub URL on a demo account, then places and closes a 0.01-lot EURUSD.z trade and reports the round-trip P&amp;amp;L" width="720" height="444"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The build, step by step
&lt;/h2&gt;

&lt;p&gt;Want to follow along? Have your MetaTrader 5 terminal and a demo account ready, and keep a terminal open beside you. And if it saves you time, a ⭐ on &lt;a href="https://github.com/vincentwongso/mt5-trading-mcp" rel="noopener noreferrer"&gt;the repo&lt;/a&gt; helps other traders find it.&lt;/p&gt;

&lt;p&gt;I'll use &lt;strong&gt;OpenClaw&lt;/strong&gt; as the example agent throughout. It's open source, and the same MCP registration maps cleanly to Codex, Claude Code, Hermes, or whatever you already run.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📝 &lt;em&gt;Commands verified against a clean install on native Windows. The OpenClaw flow below installs the server **from its GitHub URL via &lt;code&gt;uvx&lt;/code&gt; (&lt;a href="https://docs.astral.sh/uv/" rel="noopener noreferrer"&gt;python package manager&lt;/a&gt;)&lt;/em&gt;* — no manual clone, no PyPI release needed. (&lt;code&gt;uvx&lt;/code&gt; fetches and runs the package straight from the repo.)*&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;0. Prerequisites&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Four things on the machine, plus a terminal open beside you:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What you need&lt;/th&gt;
&lt;th&gt;Why&lt;/th&gt;
&lt;th&gt;Ready when&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;A Windows machine&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The &lt;code&gt;MetaTrader5&lt;/code&gt; Python library talks to the local terminal natively&lt;/td&gt;
&lt;td&gt;On Linux? Use the &lt;a href="https://github.com/vincentwongso/mt5-trading-mcp/blob/main/docs/installation.md" rel="noopener noreferrer"&gt;headless setup guide&lt;/a&gt; instead&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;MetaTrader 5 on a demo account&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The account your agent reads and trades&lt;/td&gt;
&lt;td&gt;Logged in, &lt;strong&gt;AlgoTrading ON&lt;/strong&gt; (Tools → Options → Expert Advisors → &lt;em&gt;Allow algorithmic trading&lt;/em&gt;) and the toolbar button &lt;strong&gt;green&lt;/strong&gt; — it silently resets after an account switch&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;&lt;a href="https://docs.astral.sh/uv/" rel="noopener noreferrer"&gt;&lt;code&gt;uv&lt;/code&gt; / &lt;code&gt;uvx&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt; on your PATH, you can ask your AI agent to install it for you&lt;/td&gt;
&lt;td&gt;Installs and runs the MCP server&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;uvx --version&lt;/code&gt; prints a version&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;OpenClaw&lt;/strong&gt; (or any other AI agent)&lt;/td&gt;
&lt;td&gt;Registers and calls the MCP tools&lt;/td&gt;
&lt;td&gt;Its gateway is running&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;1. Have the agent install the MCP server&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is the part that makes the demo above work: you don't pre-wire anything. &lt;strong&gt;You simply hand OpenClaw the GitHub URL above and let it set up the server itself&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;But if you want to be precise, you can give OpenClaw the following instructions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Install the MT5 trading MCP from its GitHub repo and wire it into yourself so you
can use its tools. Run these two commands:

openclaw mcp add mt5-mcp --command uvx --arg=--from --arg=git+https://github.com/vincentwongso/mt5-trading-mcp --arg=mt5-mcp --arg=serve --arg=--eager-connect
openclaw mcp reload

Then confirm by running:  openclaw mcp probe mt5-mcp  — and tell me how many tools
it found. My MetaTrader 5 terminal is already running on a demo account, so it
connects at startup. Do NOT place any trades yet.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The agent runs the commands itself and reports back &lt;strong&gt;15 tools found&lt;/strong&gt;. If you'd rather register it by hand instead of having the agent do it, the equivalent one-liner is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;openclaw mcp add mt5-mcp &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--command&lt;/span&gt; uvx &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--arg&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nt"&gt;--from&lt;/span&gt; &lt;span class="nt"&gt;--arg&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;git+https://github.com/vincentwongso/mt5-trading-mcp &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--arg&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;mt5-mcp &lt;span class="nt"&gt;--arg&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;serve &lt;span class="nt"&gt;--arg&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nt"&gt;--eager-connect&lt;/span&gt;
openclaw mcp reload
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Why &lt;code&gt;--eager-connect&lt;/code&gt;?&lt;/strong&gt; Over stdio the server otherwise connects to MT5 &lt;em&gt;lazily&lt;/em&gt;, on the first tool call — and the MetaTrader5 import + &lt;code&gt;initialize()&lt;/code&gt; takes ~180 s, so the agent appears to hang. &lt;code&gt;--eager-connect&lt;/code&gt; connects once on the main thread at startup (~0.1 s) instead. It's built into the server on &lt;code&gt;main&lt;/code&gt;, so installing straight from the GitHub URL gives it to you for free.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Other agents (Claude Code / Claude Desktop):&lt;/strong&gt; register &lt;code&gt;mt5-mcp serve --eager-connect&lt;/code&gt; as a stdio server using the &lt;strong&gt;absolute&lt;/strong&gt; path to your venv's Python — there's a sample &lt;code&gt;.mcp.json&lt;/code&gt; at the repo root to copy from. (A bare &lt;code&gt;python&lt;/code&gt; can resolve to a different/32-bit interpreter when a GUI client spawns the server.)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;2. Confirm the agent can see your account (read-only first)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once the tools are loaded, ask something harmless before anything mutating:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;"What's my account balance, and what's the EURUSD quote right now?"&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Watch it fan out the read-only tool calls and answer. You can replace EURUSD with whatever symbol your broker supports. This is the "it can actually see my account" moment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Run the round-trip: open, close, and report P&amp;amp;L&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Send this as the next message (the trade tools load on the turn after the reload):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Now, using the mt5-mcp tools on this demo account, do a full round-trip in order:
(1) report my balance;
(2) get the EURUSD quote;
(3) place a market BUY of 0.01 lots of EURUSD;
(4) show the open position (ticket + open price);
(5) close it fully;
(6) report the round-trip realized P&amp;amp;L and my new balance. Use the exact symbol EURUSD and keep each step concise.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It places the order, shows the open position, closes it, and reports the realized P&amp;amp;L and your new balance, exactly the sequence in the GIF above. Here's the round-trip as MetaTrader 5 recorded it in the History tab:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9qacxw7nomadyzln2a80.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9qacxw7nomadyzln2a80.png" alt="MetaTrader 5 History tab on a demo account: two 0.01-lot EURUSD.z deals, realized P&amp;amp;L of −0.16, balance 99,999.84" width="800" height="52"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The closed round-trip on the demo account — opened at 1.16313, closed at 1.16318, −0.16 net. Small, real, and entirely the agent's doing.&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;.z&lt;/code&gt; suffix:&lt;/strong&gt; my broker (Fintrix Markets) suffixes FX/metals (&lt;code&gt;EURUSD.z&lt;/code&gt;, &lt;code&gt;XAUUSD.z&lt;/code&gt;) and leaves crypto unsuffixed (&lt;code&gt;BTCUSD&lt;/code&gt;). &lt;strong&gt;Swap &lt;code&gt;EURUSD.z&lt;/code&gt; for your broker's symbol&lt;/strong&gt; if it differs. Not sure what it is? Check with your broker, or have your agent list the symbols.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A note on approvals:&lt;/strong&gt; for this demo the consent gate is opt-in/off, so a &lt;code&gt;0.01&lt;/code&gt;-lot order runs in one pass. For real use, leave the mutating tools un-allowlisted and set a low positive &lt;code&gt;auto_approve_notional&lt;/code&gt; so a human confirms every material trade. The MCP is a convenience layer, &lt;strong&gt;not&lt;/strong&gt; the security boundary - the broker enforces the hard limits.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What just happened
&lt;/h2&gt;

&lt;p&gt;That's it, that is the foundation. Now your agent is linked into your MT5 account, it can monitors &amp;amp; execute trades on your behalf.&lt;/p&gt;

&lt;p&gt;Its capability is still limited but we'll slowly add more functions &amp;amp; abilities in the next piece.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Try it tonight:&lt;/strong&gt; point your agent to your MT5 demo account (any brokers), hand it the GitHub repo above, and ask it to play around with it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Troubleshooting &amp;amp; reporting issues
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Symptom&lt;/th&gt;
&lt;th&gt;Likely cause&lt;/th&gt;
&lt;th&gt;Fix&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Agent hangs ~3 min on the first tool call&lt;/td&gt;
&lt;td&gt;Connecting to MT5 lazily&lt;/td&gt;
&lt;td&gt;Make sure &lt;code&gt;--eager-connect&lt;/code&gt; is in the install command&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;0 tools found&lt;/code&gt; on probe&lt;/td&gt;
&lt;td&gt;Server didn't register, or the gateway wasn't reloaded&lt;/td&gt;
&lt;td&gt;Re-run &lt;code&gt;openclaw mcp reload&lt;/code&gt;, then probe again&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"AlgoTrading disabled" / orders rejected&lt;/td&gt;
&lt;td&gt;The toolbar button isn't green&lt;/td&gt;
&lt;td&gt;Tools → Options → Expert Advisors → &lt;em&gt;Allow algorithmic trading&lt;/em&gt;; re-check after any account switch&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;symbol not found&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Your broker uses a different suffix&lt;/td&gt;
&lt;td&gt;List the symbols and swap &lt;code&gt;EURUSD&lt;/code&gt; for yours&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;If you encountered a bug in the MT5 MCP server layer, or want a new feature? Open an issue on &lt;a href="https://github.com/vincentwongso/mt5-trading-mcp/issues" rel="noopener noreferrer"&gt;the repo&lt;/a&gt; — include the exact command you ran and the error output.&lt;/p&gt;

&lt;p&gt;If you need anything else like setup help, questions about the series, or feedback, you can email &lt;strong&gt;&lt;a href="mailto:tech@fintrixmarkets.com"&gt;tech@fintrixmarkets.com&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;




&lt;p&gt;📬 &lt;strong&gt;The rest of the series&lt;/strong&gt; (news, risk models, strategy recognition, building an EA) lands on the &lt;a href="https://engineering.fintrixmarkets.com/series/trade-with-ai-agent/" rel="noopener noreferrer"&gt;Fintrix engineering blog&lt;/a&gt; — that's where new parts go up first.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Rather not wire any of this up yourself? A done-for-you version is coming at the end of the series. Same list, I'll let you know when it's ready.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Disclaimer
&lt;/h2&gt;

&lt;p&gt;This is educational and experimental engineering content, not financial advice. Everything shown runs on a demo account. CFDs are complex, leveraged instruments and the large majority of retail accounts lose money. An AI agent does not change that. It cannot guarantee profits and can act on bad instructions or stale data. Run it locally, understand how it works, and never point it at real capital you can't afford to lose. See &lt;code&gt;DISCLAIMER.md&lt;/code&gt; and &lt;code&gt;SECURITY.md&lt;/code&gt; in the repo.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Full disclosure: The author works at &lt;a href="https://fintrixmarkets.com/" rel="noopener noreferrer"&gt;&lt;strong&gt;Fintrix Markets&lt;/strong&gt;&lt;/a&gt;, a CFD broker, and the demo account used throughout this walkthrough is a demo account from Fintrix Markets. But nothing here depends on it. The entire setup is **broker-agnostic&lt;/em&gt;* and works on any CFD broker that supports MetaTrader 5 platform. This is an experimental side project, not a Fintrix Markets product.*&lt;/p&gt;

</description>
      <category>ai</category>
      <category>mcp</category>
      <category>trading</category>
      <category>python</category>
    </item>
  </channel>
</rss>
