Automation·

Your Trading Results in Google Sheets, Updated Automatically

Get the balance, growth, drawdown, daily curve and monthly returns of your MT4, MT5, cTrader or TradeLocker account into Google Sheets with a short script and a free API. No CSV exports: the sheet refreshes on a timer.

A spreadsheet is where many traders do their own thinking: a table of months, a formula for risk, a chart nobody else has. The trouble is getting the numbers in. The usual way is to export a report or a CSV from the platform and paste it, and to do it again every time you want the sheet to be true.

This guide replaces the pasting with a short script. Your Google Sheet asks a free API for the figures of your account and rewrites itself on a timer.

🧭 How It Works

PieceWhat it does
Your trading accountConnected to ShowMyTrades once, read-only
The ShowMyTrades APIReturns the account as JSON, with the statistics already computed
A script in your sheetAsks the API and writes three tabs: Summary, Daily, Monthly
A timerRuns the script every hour, or as often as you like

Nothing is installed on your computer, and nothing has to stay open.

✅ Before You Start

  1. Sign up free and connect your account read-only: MT4 or MT5, cTrader or TradeLocker.
  2. Note the slug of the account: the last part of the address of its page, https://showmytrades.com/account/YOUR-ACCOUNT-SLUG.
  3. Create a free Developer API Key under Settings in the dashboard, and copy it at once: it is shown only one time. If the account is published the script also works with no key, but with a key you have a request limit of your own.

📝 Step 1: Paste the Script

In your Google Sheet open Extensions → Apps Script, delete what is there and paste this. Put your slug and your key in the first two lines.

const SLUG = 'YOUR-ACCOUNT-SLUG'
const KEY = '' // your Developer API Key; leave empty for a published account

function updateTradingResults() {
  const options = { muteHttpExceptions: true }
  if (KEY) options.headers = { Authorization: 'Bearer ' + KEY }

  const response = UrlFetchApp.fetch(
    'https://showmytrades.com/api/v1/accounts/' + SLUG + '?include=equity_curve,monthly',
    options
  )
  if (response.getResponseCode() !== 200) return // keep the last good data

  const account = JSON.parse(response.getContentText())
  const book = SpreadsheetApp.getActiveSpreadsheet()

  writeTab(book, 'Summary', [
    ['Account', account.name],
    ['Platform', account.platform],
    ['Currency', account.currency],
    ['Balance', account.balance],
    ['Equity', account.equity],
    ['Growth %', account.performance.twr_percent],
    ['Max drawdown %', account.performance.max_drawdown_percent],
    ['Updated', new Date()],
    [account.attribution.text, account.attribution.url]
  ])

  writeTab(book, 'Daily', [['Date', 'Growth %', 'Balance', 'Equity', 'Drawdown %']].concat(
    account.equity_curve.daily_performance.map(day => [
      day.date, day.twr_percent, day.cumulative_balance, day.cumulative_equity, day.drawdown
    ])
  ))

  writeTab(book, 'Monthly', [['Month', 'Profit', 'Return %']].concat(
    account.monthly.monthly_performance.map(month => [
      month.date, month.monthly_profit, month.monthly_percent
    ])
  ))
}

function writeTab(book, name, rows) {
  const sheet = book.getSheetByName(name) || book.insertSheet(name)
  sheet.clearContents()
  sheet.getRange(1, 1, rows.length, rows[0].length).setValues(rows)
}

Save, choose updateTradingResults in the toolbar and click Run. The first time, Google asks you to authorise the script: it needs to call an outside address and to write in this spreadsheet. Then look at your sheet: three new tabs, filled in.

TabWhat is in it
SummaryName, platform, currency, balance, equity, growth, maximum drawdown, time of the last update
DailyOne row per trading day: growth so far, balance, equity, drawdown
MonthlyOne row per month: profit in money and return in percent

⏱️ Step 2: Put It on a Timer

In the Apps Script editor open Triggers (the clock on the left) and click Add Trigger.

SettingChoose
FunctionupdateTradingResults
Event sourceTime-driven
TypeHour timer
IntervalEvery hour

From now on the sheet refreshes by itself, also when it is closed. Every hour is enough for daily and monthly figures. If you want it faster, a minutes timer works too.

📈 Step 3: Build on Top of It

The three tabs are rewritten at every run, so do your own work in other tabs that point at them.

  • A chart. Select the Date and Growth % columns of the Daily tab, then Insert → Chart. It grows as new days arrive.
  • Your own formulas. For example, the best month: =MAX(Monthly!C2:C). Or the number of losing months: =COUNTIF(Monthly!C2:C,"<0").
  • More data. Add by_symbol or advanced to the include list in the script to get the results per instrument, the profit factor, the Sharpe ratio and the other risk metrics. The fields are listed in MT4 and MT5 account data as JSON.

The growth in the sheet is a time-weighted return: deposits and withdrawals do not move it. That is the figure a spreadsheet built from a raw export usually gets wrong.

🔐 Two Things About the Key

  • Who can see it. The key sits in the script, so anyone who can edit the spreadsheet can read it. Share the sheet as view-only, or keep the script in a copy that only you can edit.
  • If it leaks. Revoke it in the dashboard and create a new one. The key can only read: it cannot trade and it cannot change an account.

🤝 What the API Asks in Return

The API is free. On the free plan, wherever you show the data to other people, the line Data from ShowMyTrades goes with it, with its address. The script already writes it in the last row of the Summary tab: keep that row when you share or publish the sheet. On the Pro and Ultra plans the line is optional.

❓ FAQ

Does MetaTrader have to stay open? Not with the investor password: nothing runs on your side. With our Expert Advisor the data flows while your terminal runs.

Can I do the same in Excel? Yes. Excel can read a web address that returns JSON with Data → From Web. For a published account the address in the script is all you need.

Can I have several accounts in one spreadsheet? Yes. With a key, https://showmytrades.com/api/v1/accounts returns all your accounts in one answer, each with its balance, growth and drawdown: one row per account.

Why not IMPORTDATA or a similar formula? Google Sheets has no built-in formula that reads JSON. A short script is the reliable way, and it lets you choose when the sheet refreshes.

How many requests can I make? 30 per minute with a free key, 120 on the Pro and Ultra plans. A sheet that refreshes every hour uses one.

Is it free? Yes. Connecting the account and the API cost nothing.


Connect your account free, paste the script, and stop exporting CSV files.