[{"data":1,"prerenderedAt":1538},["ShallowReactive",2],{"\u002Fguides\u002Ftrading-results-in-google-sheets":3,"\u002Fguides\u002Ftrading-results-in-google-sheets-surround":1516,"\u002Fguides\u002Ftrading-results-in-google-sheets-langs":1526},{"id":4,"title":5,"authors":6,"badge":12,"body":14,"date":1504,"description":1505,"draft":1506,"extension":1507,"image":1508,"meta":1510,"navigation":207,"path":1511,"seo":1512,"stem":1513,"updated":1514,"__hash__":1515},"posts\u002F3.guides\u002F47.trading-results-in-google-sheets.md","Your Trading Results in Google Sheets, Updated Automatically",[7],{"name":8,"to":9,"avatar":10},"ShowMyTrades Team","https:\u002F\u002Fshowmytrades.com",{"src":11},"\u002Ficon-512.png",{"label":13},"Automation",{"type":15,"value":16,"toc":1493},"minimark",[17,21,24,29,90,93,97,138,142,149,1192,1203,1244,1248,1258,1305,1308,1312,1319,1363,1371,1375,1389,1393,1400,1404,1410,1416,1426,1436,1442,1448,1452,1480,1483,1489],[18,19,20],"p",{},"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.",[18,22,23],{},"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.",[25,26,28],"h2",{"id":27},"how-it-works","🧭 How It Works",[30,31,32,45],"table",{},[33,34,35],"thead",{},[36,37,38,42],"tr",{},[39,40,41],"th",{},"Piece",[39,43,44],{},"What it does",[46,47,48,60,70,80],"tbody",{},[36,49,50,57],{},[51,52,53],"td",{},[54,55,56],"strong",{},"Your trading account",[51,58,59],{},"Connected to ShowMyTrades once, read-only",[36,61,62,67],{},[51,63,64],{},[54,65,66],{},"The ShowMyTrades API",[51,68,69],{},"Returns the account as JSON, with the statistics already computed",[36,71,72,77],{},[51,73,74],{},[54,75,76],{},"A script in your sheet",[51,78,79],{},"Asks the API and writes three tabs: Summary, Daily, Monthly",[36,81,82,87],{},[51,83,84],{},[54,85,86],{},"A timer",[51,88,89],{},"Runs the script every hour, or as often as you like",[18,91,92],{},"Nothing is installed on your computer, and nothing has to stay open.",[25,94,96],{"id":95},"before-you-start","✅ Before You Start",[98,99,100,119,131],"ol",{},[101,102,103,108,109,113,114,118],"li",{},[104,105,107],"a",{"href":106},"\u002Fsignup","Sign up free"," and connect your account read-only: ",[104,110,112],{"href":111},"\u002Fguides\u002Fshow-mt4-mt5-results-on-your-website","MT4 or MT5",", ",[104,115,117],{"href":116},"\u002Fguides\u002Fshow-ctrader-results-on-your-website","cTrader"," or TradeLocker.",[101,120,121,122,125,126,130],{},"Note the ",[54,123,124],{},"slug"," of the account: the last part of the address of its page, ",[127,128,129],"code",{},"https:\u002F\u002Fshowmytrades.com\u002Faccount\u002FYOUR-ACCOUNT-SLUG",".",[101,132,133,134,137],{},"Create a free ",[54,135,136],{},"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.",[25,139,141],{"id":140},"step-1-paste-the-script","📝 Step 1: Paste the Script",[18,143,144,145,148],{},"In your Google Sheet open ",[54,146,147],{},"Extensions → Apps Script",", delete what is there and paste this. Put your slug and your key in the first two lines.",[150,151,156],"pre",{"className":152,"code":153,"language":154,"meta":155,"style":155},"language-js shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","const SLUG = 'YOUR-ACCOUNT-SLUG'\nconst KEY = '' \u002F\u002F your Developer API Key; leave empty for a published account\n\nfunction updateTradingResults() {\n  const options = { muteHttpExceptions: true }\n  if (KEY) options.headers = { Authorization: 'Bearer ' + KEY }\n\n  const response = UrlFetchApp.fetch(\n    'https:\u002F\u002Fshowmytrades.com\u002Fapi\u002Fv1\u002Faccounts\u002F' + SLUG + '?include=equity_curve,monthly',\n    options\n  )\n  if (response.getResponseCode() !== 200) return \u002F\u002F keep the last good data\n\n  const account = JSON.parse(response.getContentText())\n  const book = SpreadsheetApp.getActiveSpreadsheet()\n\n  writeTab(book, 'Summary', [\n    ['Account', account.name],\n    ['Platform', account.platform],\n    ['Currency', account.currency],\n    ['Balance', account.balance],\n    ['Equity', account.equity],\n    ['Growth %', account.performance.twr_percent],\n    ['Max drawdown %', account.performance.max_drawdown_percent],\n    ['Updated', new Date()],\n    [account.attribution.text, account.attribution.url]\n  ])\n\n  writeTab(book, 'Daily', [['Date', 'Growth %', 'Balance', 'Equity', 'Drawdown %']].concat(\n    account.equity_curve.daily_performance.map(day => [\n      day.date, day.twr_percent, day.cumulative_balance, day.cumulative_equity, day.drawdown\n    ])\n  ))\n\n  writeTab(book, 'Monthly', [['Month', 'Profit', 'Return %']].concat(\n    account.monthly.monthly_performance.map(month => [\n      month.date, month.monthly_profit, month.monthly_percent\n    ])\n  ))\n}\n\nfunction writeTab(book, name, rows) {\n  const sheet = book.getSheetByName(name) || book.insertSheet(name)\n  sheet.clearContents()\n  sheet.getRange(1, 1, rows.length, rows[0].length).setValues(rows)\n}\n","js","",[127,157,158,185,202,209,225,254,303,308,329,357,363,369,402,407,438,459,464,490,517,542,567,592,617,647,676,701,735,741,746,819,851,898,904,910,915,970,998,1027,1032,1037,1043,1048,1075,1115,1128,1187],{"__ignoreMap":155},[159,160,163,167,171,175,178,182],"span",{"class":161,"line":162},"line",1,[159,164,166],{"class":165},"spNyl","const",[159,168,170],{"class":169},"sTEyZ"," SLUG ",[159,172,174],{"class":173},"sMK4o","=",[159,176,177],{"class":173}," '",[159,179,181],{"class":180},"sfazB","YOUR-ACCOUNT-SLUG",[159,183,184],{"class":173},"'\n",[159,186,188,190,193,195,198],{"class":161,"line":187},2,[159,189,166],{"class":165},[159,191,192],{"class":169}," KEY ",[159,194,174],{"class":173},[159,196,197],{"class":173}," ''",[159,199,201],{"class":200},"sHwdD"," \u002F\u002F your Developer API Key; leave empty for a published account\n",[159,203,205],{"class":161,"line":204},3,[159,206,208],{"emptyLinePlaceholder":207},true,"\n",[159,210,212,215,219,222],{"class":161,"line":211},4,[159,213,214],{"class":165},"function",[159,216,218],{"class":217},"s2Zo4"," updateTradingResults",[159,220,221],{"class":173},"()",[159,223,224],{"class":173}," {\n",[159,226,228,231,234,237,240,244,247,251],{"class":161,"line":227},5,[159,229,230],{"class":165},"  const",[159,232,233],{"class":169}," options",[159,235,236],{"class":173}," =",[159,238,239],{"class":173}," {",[159,241,243],{"class":242},"swJcz"," muteHttpExceptions",[159,245,246],{"class":173},":",[159,248,250],{"class":249},"sfNiH"," true",[159,252,253],{"class":173}," }\n",[159,255,257,261,264,267,270,273,275,278,280,282,285,287,289,292,295,298,301],{"class":161,"line":256},6,[159,258,260],{"class":259},"s7zQu","  if",[159,262,263],{"class":242}," (",[159,265,266],{"class":169},"KEY",[159,268,269],{"class":242},") ",[159,271,272],{"class":169},"options",[159,274,130],{"class":173},[159,276,277],{"class":169},"headers",[159,279,236],{"class":173},[159,281,239],{"class":173},[159,283,284],{"class":242}," Authorization",[159,286,246],{"class":173},[159,288,177],{"class":173},[159,290,291],{"class":180},"Bearer ",[159,293,294],{"class":173},"'",[159,296,297],{"class":173}," +",[159,299,300],{"class":169}," KEY",[159,302,253],{"class":173},[159,304,306],{"class":161,"line":305},7,[159,307,208],{"emptyLinePlaceholder":207},[159,309,311,313,316,318,321,323,326],{"class":161,"line":310},8,[159,312,230],{"class":165},[159,314,315],{"class":169}," response",[159,317,236],{"class":173},[159,319,320],{"class":169}," UrlFetchApp",[159,322,130],{"class":173},[159,324,325],{"class":217},"fetch",[159,327,328],{"class":242},"(\n",[159,330,332,335,338,340,342,345,347,349,352,354],{"class":161,"line":331},9,[159,333,334],{"class":173},"    '",[159,336,337],{"class":180},"https:\u002F\u002Fshowmytrades.com\u002Fapi\u002Fv1\u002Faccounts\u002F",[159,339,294],{"class":173},[159,341,297],{"class":173},[159,343,344],{"class":169}," SLUG",[159,346,297],{"class":173},[159,348,177],{"class":173},[159,350,351],{"class":180},"?include=equity_curve,monthly",[159,353,294],{"class":173},[159,355,356],{"class":173},",\n",[159,358,360],{"class":161,"line":359},10,[159,361,362],{"class":169},"    options\n",[159,364,366],{"class":161,"line":365},11,[159,367,368],{"class":242},"  )\n",[159,370,372,374,376,379,381,384,387,390,394,396,399],{"class":161,"line":371},12,[159,373,260],{"class":259},[159,375,263],{"class":242},[159,377,378],{"class":169},"response",[159,380,130],{"class":173},[159,382,383],{"class":217},"getResponseCode",[159,385,386],{"class":242},"() ",[159,388,389],{"class":173},"!==",[159,391,393],{"class":392},"sbssI"," 200",[159,395,269],{"class":242},[159,397,398],{"class":259},"return",[159,400,401],{"class":200}," \u002F\u002F keep the last good data\n",[159,403,405],{"class":161,"line":404},13,[159,406,208],{"emptyLinePlaceholder":207},[159,408,410,412,415,417,420,422,425,428,430,432,435],{"class":161,"line":409},14,[159,411,230],{"class":165},[159,413,414],{"class":169}," account",[159,416,236],{"class":173},[159,418,419],{"class":169}," JSON",[159,421,130],{"class":173},[159,423,424],{"class":217},"parse",[159,426,427],{"class":242},"(",[159,429,378],{"class":169},[159,431,130],{"class":173},[159,433,434],{"class":217},"getContentText",[159,436,437],{"class":242},"())\n",[159,439,441,443,446,448,451,453,456],{"class":161,"line":440},15,[159,442,230],{"class":165},[159,444,445],{"class":169}," book",[159,447,236],{"class":173},[159,449,450],{"class":169}," SpreadsheetApp",[159,452,130],{"class":173},[159,454,455],{"class":217},"getActiveSpreadsheet",[159,457,458],{"class":242},"()\n",[159,460,462],{"class":161,"line":461},16,[159,463,208],{"emptyLinePlaceholder":207},[159,465,467,470,472,475,478,480,483,485,487],{"class":161,"line":466},17,[159,468,469],{"class":217},"  writeTab",[159,471,427],{"class":242},[159,473,474],{"class":169},"book",[159,476,477],{"class":173},",",[159,479,177],{"class":173},[159,481,482],{"class":180},"Summary",[159,484,294],{"class":173},[159,486,477],{"class":173},[159,488,489],{"class":242}," [\n",[159,491,493,496,498,501,503,505,507,509,512,515],{"class":161,"line":492},18,[159,494,495],{"class":242},"    [",[159,497,294],{"class":173},[159,499,500],{"class":180},"Account",[159,502,294],{"class":173},[159,504,477],{"class":173},[159,506,414],{"class":169},[159,508,130],{"class":173},[159,510,511],{"class":169},"name",[159,513,514],{"class":242},"]",[159,516,356],{"class":173},[159,518,520,522,524,527,529,531,533,535,538,540],{"class":161,"line":519},19,[159,521,495],{"class":242},[159,523,294],{"class":173},[159,525,526],{"class":180},"Platform",[159,528,294],{"class":173},[159,530,477],{"class":173},[159,532,414],{"class":169},[159,534,130],{"class":173},[159,536,537],{"class":169},"platform",[159,539,514],{"class":242},[159,541,356],{"class":173},[159,543,545,547,549,552,554,556,558,560,563,565],{"class":161,"line":544},20,[159,546,495],{"class":242},[159,548,294],{"class":173},[159,550,551],{"class":180},"Currency",[159,553,294],{"class":173},[159,555,477],{"class":173},[159,557,414],{"class":169},[159,559,130],{"class":173},[159,561,562],{"class":169},"currency",[159,564,514],{"class":242},[159,566,356],{"class":173},[159,568,570,572,574,577,579,581,583,585,588,590],{"class":161,"line":569},21,[159,571,495],{"class":242},[159,573,294],{"class":173},[159,575,576],{"class":180},"Balance",[159,578,294],{"class":173},[159,580,477],{"class":173},[159,582,414],{"class":169},[159,584,130],{"class":173},[159,586,587],{"class":169},"balance",[159,589,514],{"class":242},[159,591,356],{"class":173},[159,593,595,597,599,602,604,606,608,610,613,615],{"class":161,"line":594},22,[159,596,495],{"class":242},[159,598,294],{"class":173},[159,600,601],{"class":180},"Equity",[159,603,294],{"class":173},[159,605,477],{"class":173},[159,607,414],{"class":169},[159,609,130],{"class":173},[159,611,612],{"class":169},"equity",[159,614,514],{"class":242},[159,616,356],{"class":173},[159,618,620,622,624,627,629,631,633,635,638,640,643,645],{"class":161,"line":619},23,[159,621,495],{"class":242},[159,623,294],{"class":173},[159,625,626],{"class":180},"Growth %",[159,628,294],{"class":173},[159,630,477],{"class":173},[159,632,414],{"class":169},[159,634,130],{"class":173},[159,636,637],{"class":169},"performance",[159,639,130],{"class":173},[159,641,642],{"class":169},"twr_percent",[159,644,514],{"class":242},[159,646,356],{"class":173},[159,648,650,652,654,657,659,661,663,665,667,669,672,674],{"class":161,"line":649},24,[159,651,495],{"class":242},[159,653,294],{"class":173},[159,655,656],{"class":180},"Max drawdown %",[159,658,294],{"class":173},[159,660,477],{"class":173},[159,662,414],{"class":169},[159,664,130],{"class":173},[159,666,637],{"class":169},[159,668,130],{"class":173},[159,670,671],{"class":169},"max_drawdown_percent",[159,673,514],{"class":242},[159,675,356],{"class":173},[159,677,679,681,683,686,688,690,693,696,699],{"class":161,"line":678},25,[159,680,495],{"class":242},[159,682,294],{"class":173},[159,684,685],{"class":180},"Updated",[159,687,294],{"class":173},[159,689,477],{"class":173},[159,691,692],{"class":173}," new",[159,694,695],{"class":217}," Date",[159,697,698],{"class":242},"()]",[159,700,356],{"class":173},[159,702,704,706,709,711,714,716,719,721,723,725,727,729,732],{"class":161,"line":703},26,[159,705,495],{"class":242},[159,707,708],{"class":169},"account",[159,710,130],{"class":173},[159,712,713],{"class":169},"attribution",[159,715,130],{"class":173},[159,717,718],{"class":169},"text",[159,720,477],{"class":173},[159,722,414],{"class":169},[159,724,130],{"class":173},[159,726,713],{"class":169},[159,728,130],{"class":173},[159,730,731],{"class":169},"url",[159,733,734],{"class":242},"]\n",[159,736,738],{"class":161,"line":737},27,[159,739,740],{"class":242},"  ])\n",[159,742,744],{"class":161,"line":743},28,[159,745,208],{"emptyLinePlaceholder":207},[159,747,749,751,753,755,757,759,762,764,766,769,771,774,776,778,780,782,784,786,788,790,792,794,796,798,800,802,804,807,809,812,814,817],{"class":161,"line":748},29,[159,750,469],{"class":217},[159,752,427],{"class":242},[159,754,474],{"class":169},[159,756,477],{"class":173},[159,758,177],{"class":173},[159,760,761],{"class":180},"Daily",[159,763,294],{"class":173},[159,765,477],{"class":173},[159,767,768],{"class":242}," [[",[159,770,294],{"class":173},[159,772,773],{"class":180},"Date",[159,775,294],{"class":173},[159,777,477],{"class":173},[159,779,177],{"class":173},[159,781,626],{"class":180},[159,783,294],{"class":173},[159,785,477],{"class":173},[159,787,177],{"class":173},[159,789,576],{"class":180},[159,791,294],{"class":173},[159,793,477],{"class":173},[159,795,177],{"class":173},[159,797,601],{"class":180},[159,799,294],{"class":173},[159,801,477],{"class":173},[159,803,177],{"class":173},[159,805,806],{"class":180},"Drawdown %",[159,808,294],{"class":173},[159,810,811],{"class":242},"]]",[159,813,130],{"class":173},[159,815,816],{"class":217},"concat",[159,818,328],{"class":242},[159,820,822,825,827,830,832,835,837,840,842,846,849],{"class":161,"line":821},30,[159,823,824],{"class":169},"    account",[159,826,130],{"class":173},[159,828,829],{"class":169},"equity_curve",[159,831,130],{"class":173},[159,833,834],{"class":169},"daily_performance",[159,836,130],{"class":173},[159,838,839],{"class":217},"map",[159,841,427],{"class":242},[159,843,845],{"class":844},"sHdIc","day",[159,847,848],{"class":165}," =>",[159,850,489],{"class":242},[159,852,854,857,859,862,864,867,869,871,873,875,877,880,882,884,886,889,891,893,895],{"class":161,"line":853},31,[159,855,856],{"class":169},"      day",[159,858,130],{"class":173},[159,860,861],{"class":169},"date",[159,863,477],{"class":173},[159,865,866],{"class":169}," day",[159,868,130],{"class":173},[159,870,642],{"class":169},[159,872,477],{"class":173},[159,874,866],{"class":169},[159,876,130],{"class":173},[159,878,879],{"class":169},"cumulative_balance",[159,881,477],{"class":173},[159,883,866],{"class":169},[159,885,130],{"class":173},[159,887,888],{"class":169},"cumulative_equity",[159,890,477],{"class":173},[159,892,866],{"class":169},[159,894,130],{"class":173},[159,896,897],{"class":169},"drawdown\n",[159,899,901],{"class":161,"line":900},32,[159,902,903],{"class":242},"    ])\n",[159,905,907],{"class":161,"line":906},33,[159,908,909],{"class":242},"  ))\n",[159,911,913],{"class":161,"line":912},34,[159,914,208],{"emptyLinePlaceholder":207},[159,916,918,920,922,924,926,928,931,933,935,937,939,942,944,946,948,951,953,955,957,960,962,964,966,968],{"class":161,"line":917},35,[159,919,469],{"class":217},[159,921,427],{"class":242},[159,923,474],{"class":169},[159,925,477],{"class":173},[159,927,177],{"class":173},[159,929,930],{"class":180},"Monthly",[159,932,294],{"class":173},[159,934,477],{"class":173},[159,936,768],{"class":242},[159,938,294],{"class":173},[159,940,941],{"class":180},"Month",[159,943,294],{"class":173},[159,945,477],{"class":173},[159,947,177],{"class":173},[159,949,950],{"class":180},"Profit",[159,952,294],{"class":173},[159,954,477],{"class":173},[159,956,177],{"class":173},[159,958,959],{"class":180},"Return %",[159,961,294],{"class":173},[159,963,811],{"class":242},[159,965,130],{"class":173},[159,967,816],{"class":217},[159,969,328],{"class":242},[159,971,973,975,977,980,982,985,987,989,991,994,996],{"class":161,"line":972},36,[159,974,824],{"class":169},[159,976,130],{"class":173},[159,978,979],{"class":169},"monthly",[159,981,130],{"class":173},[159,983,984],{"class":169},"monthly_performance",[159,986,130],{"class":173},[159,988,839],{"class":217},[159,990,427],{"class":242},[159,992,993],{"class":844},"month",[159,995,848],{"class":165},[159,997,489],{"class":242},[159,999,1001,1004,1006,1008,1010,1013,1015,1018,1020,1022,1024],{"class":161,"line":1000},37,[159,1002,1003],{"class":169},"      month",[159,1005,130],{"class":173},[159,1007,861],{"class":169},[159,1009,477],{"class":173},[159,1011,1012],{"class":169}," month",[159,1014,130],{"class":173},[159,1016,1017],{"class":169},"monthly_profit",[159,1019,477],{"class":173},[159,1021,1012],{"class":169},[159,1023,130],{"class":173},[159,1025,1026],{"class":169},"monthly_percent\n",[159,1028,1030],{"class":161,"line":1029},38,[159,1031,903],{"class":242},[159,1033,1035],{"class":161,"line":1034},39,[159,1036,909],{"class":242},[159,1038,1040],{"class":161,"line":1039},40,[159,1041,1042],{"class":173},"}\n",[159,1044,1046],{"class":161,"line":1045},41,[159,1047,208],{"emptyLinePlaceholder":207},[159,1049,1051,1053,1056,1058,1060,1062,1065,1067,1070,1073],{"class":161,"line":1050},42,[159,1052,214],{"class":165},[159,1054,1055],{"class":217}," writeTab",[159,1057,427],{"class":173},[159,1059,474],{"class":844},[159,1061,477],{"class":173},[159,1063,1064],{"class":844}," name",[159,1066,477],{"class":173},[159,1068,1069],{"class":844}," rows",[159,1071,1072],{"class":173},")",[159,1074,224],{"class":173},[159,1076,1078,1080,1083,1085,1087,1089,1092,1094,1096,1098,1101,1103,1105,1108,1110,1112],{"class":161,"line":1077},43,[159,1079,230],{"class":165},[159,1081,1082],{"class":169}," sheet",[159,1084,236],{"class":173},[159,1086,445],{"class":169},[159,1088,130],{"class":173},[159,1090,1091],{"class":217},"getSheetByName",[159,1093,427],{"class":242},[159,1095,511],{"class":169},[159,1097,269],{"class":242},[159,1099,1100],{"class":173},"||",[159,1102,445],{"class":169},[159,1104,130],{"class":173},[159,1106,1107],{"class":217},"insertSheet",[159,1109,427],{"class":242},[159,1111,511],{"class":169},[159,1113,1114],{"class":242},")\n",[159,1116,1118,1121,1123,1126],{"class":161,"line":1117},44,[159,1119,1120],{"class":169},"  sheet",[159,1122,130],{"class":173},[159,1124,1125],{"class":217},"clearContents",[159,1127,458],{"class":242},[159,1129,1131,1133,1135,1138,1140,1143,1145,1148,1150,1152,1154,1157,1159,1161,1164,1167,1169,1171,1173,1175,1177,1180,1182,1185],{"class":161,"line":1130},45,[159,1132,1120],{"class":169},[159,1134,130],{"class":173},[159,1136,1137],{"class":217},"getRange",[159,1139,427],{"class":242},[159,1141,1142],{"class":392},"1",[159,1144,477],{"class":173},[159,1146,1147],{"class":392}," 1",[159,1149,477],{"class":173},[159,1151,1069],{"class":169},[159,1153,130],{"class":173},[159,1155,1156],{"class":169},"length",[159,1158,477],{"class":173},[159,1160,1069],{"class":169},[159,1162,1163],{"class":242},"[",[159,1165,1166],{"class":392},"0",[159,1168,514],{"class":242},[159,1170,130],{"class":173},[159,1172,1156],{"class":169},[159,1174,1072],{"class":242},[159,1176,130],{"class":173},[159,1178,1179],{"class":217},"setValues",[159,1181,427],{"class":242},[159,1183,1184],{"class":169},"rows",[159,1186,1114],{"class":242},[159,1188,1190],{"class":161,"line":1189},46,[159,1191,1042],{"class":173},[18,1193,1194,1195,1198,1199,1202],{},"Save, choose ",[127,1196,1197],{},"updateTradingResults"," in the toolbar and click ",[54,1200,1201],{},"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.",[30,1204,1205,1215],{},[33,1206,1207],{},[36,1208,1209,1212],{},[39,1210,1211],{},"Tab",[39,1213,1214],{},"What is in it",[46,1216,1217,1226,1235],{},[36,1218,1219,1223],{},[51,1220,1221],{},[54,1222,482],{},[51,1224,1225],{},"Name, platform, currency, balance, equity, growth, maximum drawdown, time of the last update",[36,1227,1228,1232],{},[51,1229,1230],{},[54,1231,761],{},[51,1233,1234],{},"One row per trading day: growth so far, balance, equity, drawdown",[36,1236,1237,1241],{},[51,1238,1239],{},[54,1240,930],{},[51,1242,1243],{},"One row per month: profit in money and return in percent",[25,1245,1247],{"id":1246},"️-step-2-put-it-on-a-timer","⏱️ Step 2: Put It on a Timer",[18,1249,1250,1251,1254,1255,130],{},"In the Apps Script editor open ",[54,1252,1253],{},"Triggers"," (the clock on the left) and click ",[54,1256,1257],{},"Add Trigger",[30,1259,1260,1270],{},[33,1261,1262],{},[36,1263,1264,1267],{},[39,1265,1266],{},"Setting",[39,1268,1269],{},"Choose",[46,1271,1272,1281,1289,1297],{},[36,1273,1274,1277],{},[51,1275,1276],{},"Function",[51,1278,1279],{},[127,1280,1197],{},[36,1282,1283,1286],{},[51,1284,1285],{},"Event source",[51,1287,1288],{},"Time-driven",[36,1290,1291,1294],{},[51,1292,1293],{},"Type",[51,1295,1296],{},"Hour timer",[36,1298,1299,1302],{},[51,1300,1301],{},"Interval",[51,1303,1304],{},"Every hour",[18,1306,1307],{},"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.",[25,1309,1311],{"id":1310},"step-3-build-on-top-of-it","📈 Step 3: Build on Top of It",[18,1313,1314,1315,1318],{},"The three tabs are rewritten at every run, so do your own work in ",[54,1316,1317],{},"other"," tabs that point at them.",[1320,1321,1322,1328,1341],"ul",{},[101,1323,1324,1327],{},[54,1325,1326],{},"A chart."," Select the Date and Growth % columns of the Daily tab, then Insert → Chart. It grows as new days arrive.",[101,1329,1330,1333,1334,1337,1338,130],{},[54,1331,1332],{},"Your own formulas."," For example, the best month: ",[127,1335,1336],{},"=MAX(Monthly!C2:C)",". Or the number of losing months: ",[127,1339,1340],{},"=COUNTIF(Monthly!C2:C,\"\u003C0\")",[101,1342,1343,1346,1347,1350,1351,1354,1355,1358,1359,130],{},[54,1344,1345],{},"More data."," Add ",[127,1348,1349],{},"by_symbol"," or ",[127,1352,1353],{},"advanced"," to the ",[127,1356,1357],{},"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 ",[104,1360,1362],{"href":1361},"\u002Fguides\u002Fmt4-mt5-account-data-json-api","MT4 and MT5 account data as JSON",[18,1364,1365,1366,1370],{},"The growth in the sheet is a ",[104,1367,1369],{"href":1368},"\u002Fguides\u002Ftime-weighted-return-explained","time-weighted return",": deposits and withdrawals do not move it. That is the figure a spreadsheet built from a raw export usually gets wrong.",[25,1372,1374],{"id":1373},"two-things-about-the-key","🔐 Two Things About the Key",[1320,1376,1377,1383],{},[101,1378,1379,1382],{},[54,1380,1381],{},"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.",[101,1384,1385,1388],{},[54,1386,1387],{},"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.",[25,1390,1392],{"id":1391},"what-the-api-asks-in-return","🤝 What the API Asks in Return",[18,1394,1395,1396,1399],{},"The API is free. On the free plan, wherever you show the data to other people, the line ",[54,1397,1398],{},"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.",[25,1401,1403],{"id":1402},"faq","❓ FAQ",[18,1405,1406,1409],{},[54,1407,1408],{},"Does MetaTrader have to stay open?","\nNot with the investor password: nothing runs on your side. With our Expert Advisor the data flows while your terminal runs.",[18,1411,1412,1415],{},[54,1413,1414],{},"Can I do the same in Excel?","\nYes. 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.",[18,1417,1418,1421,1422,1425],{},[54,1419,1420],{},"Can I have several accounts in one spreadsheet?","\nYes. With a key, ",[127,1423,1424],{},"https:\u002F\u002Fshowmytrades.com\u002Fapi\u002Fv1\u002Faccounts"," returns all your accounts in one answer, each with its balance, growth and drawdown: one row per account.",[18,1427,1428,1435],{},[54,1429,1430,1431,1434],{},"Why not ",[127,1432,1433],{},"IMPORTDATA"," or a similar formula?","\nGoogle 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.",[18,1437,1438,1441],{},[54,1439,1440],{},"How many requests can I make?","\n30 per minute with a free key, 120 on the Pro and Ultra plans. A sheet that refreshes every hour uses one.",[18,1443,1444,1447],{},[54,1445,1446],{},"Is it free?","\nYes. Connecting the account and the API cost nothing.",[25,1449,1451],{"id":1450},"related-guides","🔗 Related Guides",[1320,1453,1454,1459,1466,1473],{},[101,1455,1456,1458],{},[104,1457,1362],{"href":1361},": every endpoint and field",[101,1460,1461,1465],{},[104,1462,1464],{"href":1463},"\u002Fguides\u002Fself-updating-trading-chart-on-your-website-api","A self-updating trading chart on your website",": the same data on your own site",[101,1467,1468,1472],{},[104,1469,1471],{"href":1470},"\u002Fguides\u002Fmonthly-returns-table-explained","The monthly returns table explained",": how to read what the Monthly tab shows",[101,1474,1475,1479],{},[104,1476,1478],{"href":1477},"\u002Fguides\u002Ftracking-trading-performance","A practical guide to tracking your trading performance",": what is worth watching in the sheet",[1481,1482],"hr",{},[18,1484,1485,1488],{},[104,1486,1487],{"href":106},"Connect your account free",", paste the script, and stop exporting CSV files.",[1490,1491,1492],"style",{},"html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":155,"searchDepth":187,"depth":187,"links":1494},[1495,1496,1497,1498,1499,1500,1501,1502,1503],{"id":27,"depth":187,"text":28},{"id":95,"depth":187,"text":96},{"id":140,"depth":187,"text":141},{"id":1246,"depth":187,"text":1247},{"id":1310,"depth":187,"text":1311},{"id":1373,"depth":187,"text":1374},{"id":1391,"depth":187,"text":1392},{"id":1402,"depth":187,"text":1403},{"id":1450,"depth":187,"text":1451},"2026-11-30T00:00:00.000Z","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.",false,"md",{"src":1509},"\u002Fimages\u002Fblog\u002Ftrading-results-in-google-sheets-hero.svg",{},"\u002Fguides\u002Ftrading-results-in-google-sheets",{"title":5,"description":1505},"3.guides\u002F47.trading-results-in-google-sheets",null,"XodrDhrP74dGTZ6u3jAv4jEI2Aq9SLSxW5fOXMhEBHg",[1517,1521],{"title":1518,"path":1361,"stem":1519,"description":1520,"children":-1},"MT4 and MT5 Account Data as JSON: a Free API for Your Trading Statistics","3.guides\u002F46.mt4-mt5-account-data-json-api","MetaTrader has no web API for your own account. How to read the balance, equity, growth, drawdown, monthly returns, closed trades and open positions of an MT4 or MT5 account as JSON, with a free REST API. Examples in cURL, Python and JavaScript.",{"title":1522,"path":1523,"stem":1524,"description":1525,"children":-1},"A Myfxbook API Alternative: Your Trading Account as JSON, With a Key and No Session","\u002Fguides\u002Fmyfxbook-api-alternative","3.guides\u002F48.myfxbook-api-alternative","Looking for an alternative to the Myfxbook API? A free REST API for MT4, MT5, cTrader and TradeLocker accounts: a read-only key in a header, the whole trade history, statistics already computed. The two APIs compared method by method.",[1527,1528,1530,1532,1534,1536],{"path":1511},{"path":1529},"\u002Fde\u002Fguides\u002Ftrading-results-in-google-sheets",{"path":1531},"\u002Fes\u002Fguides\u002Ftrading-results-in-google-sheets",{"path":1533},"\u002Fid\u002Fguides\u002Ftrading-results-in-google-sheets",{"path":1535},"\u002Fja\u002Fguides\u002Ftrading-results-in-google-sheets",{"path":1537},"\u002Fzh\u002Fguides\u002Ftrading-results-in-google-sheets",1796001600069]