Backtesting a trading strategy with AI works best when the process is broken into clear, structured steps.
Below is a sequence of six prompts designed to take you from understanding a momentum research paper to adapting the strategy, pulling market data, running a backtest, and critically reviewing the results.
You can use these prompts one after another in Claude.
A sequence of six prompts that take a momentum research paper from summary, through adaptation and data pull, to a backtest and a critical review of the results.
Prompt 1: Summarise the trading mechanics
I have uploaded a research paper on momentum. Read it and give me the trading mechanics as a compact summary card: what it trades, how it selects instruments, entry and exit, and rebalance frequency. Short bullets only, maximum 4 per section, no long paragraphs.
Prompt 2: Check what a retail trader can actually implement
As a retail trader, what parts of this would be hard to implement exactly as written? Answer as two short lists: Hard to use as-is, and What survives. Maximum 4 bullets each, one line per bullet.
Prompt 3: Adapt the strategy and build a strategy card
Adapt it to: 11 US sector ETFs, long only, ranked on 12-month return, top 3 equal weight, rebalanced monthly. Create an artifact: a clean one-page strategy card with five sections, Universe, Entry Rule, Exit Rule, Position Sizing, Rebalance Frequency, and below it a simple flowchart of the monthly decision: rank all 11, is the ETF in the top 3, buy or hold, did it drop out, sell. Minimal text, visual layout.
Prompt 4: Pull the data and rank it
Using the Alpaca connection, fetch 12-month total returns for XLK, XLF, XLY, XLE, XLV, XLI, XLP, XLU, XLB, XLRE, XLC. Show the result as a ranked horizontal bar chart artifact, highest to lowest, top 3 highlighted in green. One line per ETF, no commentary.
Prompt 5: Backtest and build a dashboard
Backtest this exact rule over the past 5 years: rank monthly on 12-month return, hold the top 3 equal weight, rebalance on the first trading day of each month, benchmark SPY buy and hold. Present the results as an interactive trading dashboard artifact, dark professional theme like a real trader terminal: an equity curve of strategy vs SPY, four metric cards, total return, CAGR, Sharpe, max drawdown, and a small monthly returns strip. Short labels only, 4 to 5 sections maximum, no paragraphs.
Prompt 6: Challenge the backtest
Assume this backtest is misleading. Give me only the 4 strongest reasons not to trust it, as a compact red-flag checklist card, one line each, no explanation longer than one sentence.
Note on risk
These prompts are for research and educational use. Backtested results are hypothetical, reflect the assumptions and data used, and do not indicate future performance. Trading carries the risk of loss of capital.
Frequently Asked Questions
Do I need to know Python to use these prompts?
No, the assistant writes and runs the code for the data pull and the backtest. That said, being able to read the code it produces is what separates using a backtest from trusting one, and anyone planning to trade the result should be able to check the rebalance logic and the return calculation themselves.
Can I use a data source other than Alpaca?
Yes. Prompt 4 names Alpaca only because it is the connection used in this example. Substitute whatever market data source you have available, and if none is connected, ask the assistant to work from a CSV of historical prices you upload instead.
Why 11 sector ETFs rather than individual stocks?
Sector ETFs sidestep two problems that make retail equity backtests unreliable: survivorship bias, since delisted stocks vanish from most free datasets, and the data volume needed to rank a full cross section every month. The universe is small enough to verify by hand, which matters when you are checking whether the process works at all.
Is five years long enough to test a momentum strategy?
Usually not. Five years is a reasonable first pass because the data is easy to obtain and the result arrives quickly, but momentum strategies have historically gone through multi-year stretches of underperformance, and a window that misses one of those will flatter the rule. Extending the test to fifteen or twenty years is the natural follow up.
What is the single most common flaw in AI-generated backtests?
Lookahead bias, usually through a ranking that is computed on data the strategy would not have had at the rebalance date. It is worth asking the assistant directly to trace, for one specific rebalance, exactly which observations went into the ranking and what date each one became available.
How do I add transaction costs to the backtest?
Ask for it explicitly as a follow up to Prompt 5, specifying a per-trade cost in basis points and applying it to the turnover at each rebalance. For a monthly sector rotation the turnover is low enough that costs rarely change the conclusion, but the number should be in the model rather than assumed away.
Can this sequence be used for strategies other than momentum?
Yes. The six steps are agnostic to the underlying idea, and only Prompt 1 and Prompt 3 need rewriting for a different paper or a different universe. The value comes from the separation of steps, not from the specific momentum rule used here.
Should I trade a strategy that performs well in this backtest?
Not on this evidence alone. A single backtest on one universe, one lookback, and one five year window is a starting point for research, and the responsible next steps are out-of-sample testing, parameter sensitivity checks, and paper trading before any capital is committed
Next Steps
If you are just getting started with algorithmic trading, begin with the Quantitative Trading Free Learning Track. It includes beginner-friendly courses covering data basics, trading strategies, and coding for finance.
Once you are ready to go deeper, explore Quantra's Algorithmic Trading for Beginners Learning Track, which offers hands-on, application-focused modules to build your skills step by step.
For those looking for a comprehensive, guided journey with mentorship, live lectures, and career support, the Executive Programme in Algorithmic Trading (EPAT) provides a complete foundation for launching or accelerating a career in this field.
Schedule an EPAT counselling call. To understand if EPAT is the right choice for you, talk to one of our specialists who have counselled thousands of learners over the past decade and helped them make the right career decision.
Disclaimer: This webinar and recap are for educational and informational purposes only. Nothing discussed constitutes financial advice. Please conduct your own research and consult a qualified financial advisor before making any investment decisions.
