Can ChatGPT backtest a trading strategy?
Not on its own. ChatGPT can explain a strategy and write backtest code, but it has no built-in daily price history to run your rules on, so numbers it gives from memory are estimates, not a backtest. The Shadowfolio plugin adds the missing part inside ChatGPT: it keeps end-of-day prices for US stocks and ETFs, turns the strategy you describe into explicit rules, tests them over the last 12 months against a benchmark and can track them daily from today, with no account and no broker.
Updated · The Open Apps, Inc.
Step by step
- Add Shadowfolio. Open the listing and add it once. There is nothing to sign up for: Shadowfolio knows you only by the anonymous ID ChatGPT sends, and it never connects to a broker.
- Ask in your own words. Type "@Shadowfolio" or start with "Use Shadowfolio to", then the strategy: "would holding SPY only above its 200-day average have beaten buy-and-hold this year?" or "backtest a golden cross on QQQ".
- Check the rules. Shadowfolio writes the strategy back as explicit rules and lists anything you left open, each with the default it would use, so you can see exactly what will be tested.
- Read the 12-month result. Total return, max drawdown, Sharpe ratio, volatility, win rate and the number of trades, next to the benchmark over the same days, with both curves on the card.
- Track it from today. Say "save it" and a hypothetical 10,000 portfolio follows the same rules after every US market close, using only prices that arrive after you saved it.
What Shadowfolio does with your words
Below are two requests and what Shadowfolio's rule checker returns for them, as it returns them today. These are the rules the backtest runs; the 12-month numbers appear only in ChatGPT, after the rules run on current prices. In both, buy-and-hold is the benchmark: SPY unless you name another. "This year" means the last 12 months, the one period Shadowfolio tests.
You say“Would holding SPY only above its 200-day average, otherwise BIL, have beaten buy-and-hold this year?”
Rules Shadowfolio writes back- Trades: SPY.
- Buys when the price is above its 200-day average.
- Sells when a symbol no longer passes the buy rule at a rebalance.
- Rebalances monthly, on the first trading day of the month.
- Sizing: equal weight, up to 1 position.
- Idle money: held in BIL. Benchmark: SPY. Costs: 0.05% per trade.
- When should it sell: at the next rebalance once the buy rule no longer holds, or on its own rule (an RSI level, a stop loss, a take-profit or a holding period)? Default: sell at the next rebalance once the buy rule no longer holds.
- How often should it re-check and rebalance: daily, weekly, monthly or quarterly? Default: monthly.
- Benchmark: SPY.
- Trading costs: 0.05% per buy or sell.
You say“Backtest a golden cross on QQQ.”
Rules Shadowfolio writes back- Trades: QQQ.
- Buys when the 50-day average is above the 200-day average.
- Sells when a symbol no longer passes the buy rule at a rebalance.
- Rebalances monthly, on the first trading day of the month.
- Sizing: equal weight, up to 1 position.
- Idle money: cash at 0%. Benchmark: SPY. Costs: 0.05% per trade.
- When should it sell: at the next rebalance once the buy rule no longer holds, or on its own rule (an RSI level, a stop loss, a take-profit or a holding period)? Default: sell at the next rebalance once the buy rule no longer holds.
- How often should it re-check and rebalance: daily, weekly, monthly or quarterly? Default: monthly.
- Benchmark: SPY.
- Trading costs: 0.05% per buy or sell.
The 12-month limit
Every backtest covers the last 252 trading days, about 12 months, ending at the latest settled US close. Shadowfolio keeps about 30 months of end-of-day prices per ticker, so a 200-day average or a 12-month return already has its full look-back on the first day of the test. You can't pick another period, such as 2008 or 2020, and a ticker listed for less than that gets a shorter test, which the result says.
Prices are daily closes, adjusted for dividends and splits. Trades fill at the close with a cost of 0.05% per buy or sell unless you set another, with no taxes and no intraday prices. The S&P 500 and its sectors, about 100 popular ETFs and up to 50 tickers of your own can be tested; today's index members stand in for the whole year, which flatters past results, and every such result says so.
No account and no broker
Adding Shadowfolio needs no sign-up, email or brokerage link. Strategies you test without saving are used for the result and then discarded. Strategies you save, and their daily records, are kept under a scrambled form of the anonymous ID ChatGPT sends; saying "Delete my Shadowfolio data" removes them. Shadowfolio can't place trades, move money or see an account, and it doesn't suggest what to buy: it runs the rules you describe.
ChatGPT on its own and with Shadowfolio
| ChatGPT on its own | ChatGPT with Shadowfolio | |
|---|---|---|
| Explain a strategy or an indicator | Yes | Yes |
| Daily price history | None built in; you would find and upload a price file | About 30 months of end-of-day prices per ticker, refreshed after each US close |
| Run your rules on real prices | Only with code it writes, on a file you upload | Yes: the last 12 months, ending at the latest close |
| Where the numbers come from | Memory or your file | The engine, from stored daily closes |
| Benchmark alongside | If you ask for it and supply its prices | Always, over the same days |
| Keep going after today | No | Yes: a shadow portfolio updated after every US close |
With your own price file and some code, ChatGPT can run a backtest; Shadowfolio is for testing an idea in a few minutes without either.
Use it in ChatGPT
Backtest a strategy in ChatGPT: add Shadowfolio once, then type "@Shadowfolio" or start with "Use Shadowfolio to", and say:
- Would holding SPY only above its 200-day average, otherwise BIL, have beaten buy-and-hold this year?
Shadowfolio runs only the rules you describe. It never suggests investments, never gives advice and never places trades.
Questions
- Can ChatGPT's data analysis tool run a backtest?
- It can run backtest code on a price file you upload. Shadowfolio removes the file and the code for US stocks and ETFs: you describe the rules and it runs them on prices it already keeps.
- How far back can it test?
- The last 12 months of trading days, ending at the latest US close. Longer or custom periods aren't available.
- Which tickers work?
- US-listed stocks, ETFs and mutual funds. The S&P 500 and about 100 popular ETFs are refreshed every trading day; any other US ticker is fetched the first time you name it.
- Is a good backtest a reason to invest?
- No. It shows what rules would have done on past prices and says nothing reliable about the future. Shadowfolio gives no investment advice.