Product·

How to Put a Self-Updating Trading Chart on Your Website With a Free API

Building your own site and want the chart of your MT4, MT5, cTrader or TradeLocker account on it, updating by itself? One free API request returns the data as JSON. Complete code for the server and the page.

You are building your website, alone or with an AI assistant, and you want your trading results on it: the growth chart of your account, a few numbers under it. And you want them to stay true next week without touching anything.

The first idea is usually a report: export it from the trading platform, turn it into a chart, upload it. That chart is out of date the day after. This guide shows the other way: your account connected once, and a free API that hands your site the figures, already computed, every time it asks.

🧭 Three Ways to Do It, Compared

Export a report and upload itPaste a widgetRead the API
Stays up to dateNo: only when you export againYes, on its ownYes, on its own
DesignWhatever you buildOurs, with your theme and coloursEntirely yours
Code to writeA reader for the report, the maths, the chartNoneOne request and your chart
Growth, drawdown, monthly returnsYours to computeReadyReady, as JSON
A visitor can check the numbersNo: the file is yoursYes: the widget links to the account pageYes: the line under the chart links to it
PriceFreeFreeFree

If a ready-made chart is enough, the widget is the shortest road: see how to show your MT4 or MT5 results on your website. The rest of this page is the third column: your own chart, in your own design.

🔌 Step 1: Connect the Account, Once

Sign up free, open Add Account in the dashboard and pick your platform. Every connection is read-only: nothing here can open, change or close a trade.

PlatformHow it connects
MetaTrader 4 and 5The read-only investor password, or our small Expert Advisor on one chart
cTraderOne authorisation with your cTrader ID, nothing to install
TradeLockerThe login your broker or prop firm gave you

Your history is imported and the statistics are computed for you. From here on they follow the account: this is the part you never have to do again.

🔑 Step 2: Publish the Account, or Create a Key

The API has two doors, and you choose one.

Published accountPrivate account
What you doSet the visibility to Published in the account settingsCreate a free Developer API Key under Settings in the dashboard
API keyNot neededSent with every request
Good forA public track record: the account also gets a page a visitor can checkNumbers you want on your site without a public page

A key starts with smt_live_ and is shown only once: copy it straight away, and keep it on your server.

📡 Step 3: One Request

curl "https://showmytrades.com/api/v1/accounts/YOUR-ACCOUNT-SLUG?include=equity_curve"

YOUR-ACCOUNT-SLUG is the last part of the address of your account page, https://showmytrades.com/account/YOUR-ACCOUNT-SLUG. The answer looks like this, shortened:

{
  "name": "My EURUSD account",
  "platform": "MT5",
  "currency": "USD",
  "balance": 20980.4,
  "equity": 20911.15,
  "performance": { "twr_percent": 109.88, "max_drawdown_percent": 7.86 },
  "equity_curve": {
    "daily_performance": [
      { "date": "2025-11-10", "twr_percent": 0.99, "cumulative_balance": 20197.7, "drawdown": 0 },
      { "date": "2025-11-11", "twr_percent": 1.42, "cumulative_balance": 20283.1, "drawdown": 0 }
    ]
  },
  "attribution": {
    "required": true,
    "text": "Data from ShowMyTrades",
    "url": "https://showmytrades.com/account/YOUR-ACCOUNT-SLUG"
  }
}
FieldWhat it is
performance.twr_percentThe growth of the account in percent, with deposits and withdrawals kept out of the result
performance.max_drawdown_percentThe deepest fall from a peak, in percent
equity_curve.daily_performanceOne row per trading day: the growth so far, the balance, the equity, the drawdown
attributionThe line to show next to the data, with its link

🖥️ Step 4: A Small Function on Your Server

The request goes from your server, not from the visitor's browser: a key must stay secret, and browsers cannot call this API from another site anyway. The function asks the API every five minutes and keeps the answer, so your page stays fast.

server.js
import { createServer } from 'node:http'

const SLUG = 'YOUR-ACCOUNT-SLUG'
const KEY = process.env.SHOWMYTRADES_KEY // only for a private account
let cache = { at: 0, body: null }

async function tradingResults() {
  if (Date.now() - cache.at < 5 * 60 * 1000) return cache.body

  const response = await fetch(
    `https://showmytrades.com/api/v1/accounts/${SLUG}?include=equity_curve`,
    { headers: KEY ? { Authorization: `Bearer ${KEY}` } : {} }
  )
  if (!response.ok) return cache.body // keep showing the last good answer

  const account = await response.json()
  cache = {
    at: Date.now(),
    body: JSON.stringify({
      name: account.name,
      growth: account.performance.twr_percent,
      maxDrawdown: account.performance.max_drawdown_percent,
      days: account.equity_curve.daily_performance.map(day => ({
        date: day.date,
        growth: day.twr_percent,
        drawdown: day.drawdown
      })),
      attribution: account.attribution
    })
  }
  return cache.body
}

createServer(async (request, response) => {
  if (request.url !== '/trading-results.json') {
    response.writeHead(404).end()
    return
  }
  const body = await tradingResults()
  response.writeHead(body ? 200 : 502, { 'Content-Type': 'application/json' }).end(body ?? '{}')
}).listen(3000)

This is plain Node.js, with nothing to install. The same few lines work in any language that can make an HTTPS request: for WordPress there is a ready shortcode in PHP.

🎨 Step 5: Draw the Chart

Your page reads the small file your server prepared and draws it. This example uses Chart.js. Any charting library does the same job.

index.html
<canvas id="growth"></canvas>
<p id="source"></p>

<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
  fetch('/trading-results.json')
    .then(response => response.json())
    .then((data) => {
      new Chart(document.getElementById('growth'), {
        type: 'line',
        data: {
          labels: data.days.map(day => day.date),
          datasets: [{ label: 'Growth %', data: data.days.map(day => day.growth) }]
        }
      })

      // The line under the chart: text and link come ready in the answer.
      const link = document.createElement('a')
      link.href = data.attribution.url
      link.textContent = data.attribution.text
      document.getElementById('source').append(link)
    })
</script>

That is the whole integration. From now on the chart follows the account: you trade, the statistics are recomputed, your server picks them up at its next request, and the visitor sees them.

➕ More Data in the Same Request

Add sections to include, separated by commas. It is still one request.

You want to showAsk for
The growth, balance or drawdown curve, day by dayequity_curve
Monthly and yearly returns, and "this month so far"monthly
Results per instrumentby_symbol
Results per Expert Advisor, on MT4 and MT5by_magic_number
Profit factor, expectancy, Sharpe ratio and the other risk metricsadvanced
Growth after every single tradetwr

The format is the same for MT4, MT5, cTrader and TradeLocker, so a site that shows several accounts needs one piece of code. For more accounts on one page, see how to show multiple trading accounts on one page.

🤝 What the API Asks in Return

On the free plan, one visible line next to the data: Data from ShowMyTrades, with a link. The example above prints it already. On the Pro and Ultra plans the line is optional.

It is worth keeping either way. For a published account the link leads to the account page on ShowMyTrades, where a visitor finds the same figures on a page you do not control. A chart you drew yourself, with nothing behind it, asks the reader to take your word. A chart with that link does not.

🤖 If an AI Assistant Is Building Your Site

Give it this page, or these lines:

Show my trading results on my site with the ShowMyTrades API. Do not parse an exported report.
1. The account is connected at https://showmytrades.com (free, read-only).
2. Published account: no API key. Private account: a Developer API Key, sent as
   "Authorization: Bearer smt_live_..." from server-side code only.
3. GET https://showmytrades.com/api/v1/accounts/{slug}?include=equity_curve
4. Call it from the server, cache the answer for 5 minutes, draw equity_curve.daily_performance
   (date, twr_percent).
5. Print attribution.text linked to attribution.url next to the chart.
Full steps: https://showmytrades.com/docs/api/show-trading-results-on-your-website

An assistant left alone often proposes a script that reads a MetaTrader report. It works on the day it is written. With the API the assistant writes less code, and the chart keeps working after it has finished.

❓ FAQ

Is the API really free? Yes. Connecting the account, the API and the widgets cost nothing. You can make 30 requests per minute with a free key, and 20 per minute per IP address without a key: far more than a site that asks every five minutes needs. The Pro and Ultra plans raise the limit and make the line "Data from ShowMyTrades" optional.

Do I need an API key? Not for a published account: the request works with no key at all. A private account needs a free Developer API Key, created in the dashboard.

How often is the data updated? The statistics follow the account as trades close. Asking every five minutes, as in the example, is plenty for a chart of daily results.

Can I call the API straight from the browser? No. Call it from your server and pass the result to your page, as in the example. A key in the browser would be visible to anyone, and browsers cannot call this API from another site.

Does it work with cTrader and TradeLocker too? Yes. The answer has the same format on every platform.

Can the API place or close trades? No. It is read-only, like the connection to your account.

I would rather not write any code. What then? Use a widget: one snippet to paste, and it updates on its own too.


Connect your account free, make one request, and your site has a chart that keeps itself up to date.