Python for programmers, prompts for data analysts.
Testing a trading strategy on historical data used to mean opening a library like Backtrader: define a strategy class, loop through
price bars, compute indicators, simulate buys and sells, track the resulting equity curve. A simple test could easily run to a hundred
lines of Python before you saw a single result.
Let's test one of the oldest, most recognizable strategies there is — the "golden cross," buying when a 50-day moving average crosses
above the 200-day — the same way we've tested everything else in this series: by asking.
Want to try this yourself? The EODHD MCP Server is what
pulled the data above — connect it to Claude and ask your own questions (affiliate link).New here? The Setup covers
everything you need before your first prompt.
Run the backtest with a single sentence
🟧 PROMPT
Use the eodhd MCP to backtest a golden cross strategy on AMZN
from 2020 to today: buy when the 50-day moving average
crosses above the 200-day, sell when
it crosses below. Compare to buy-and-hold.
Over roughly six and a half years (2020–2026), the golden cross strategy triggered eight signals — four buys, four sells — the most
recent being a golden cross buy at $274.99 on May 6, 2026.$10,000 invested using the strategy grew to $10,526.69 — a 5.3% total return. $10,000 in plain buy-and-hold grew to $27,057.81 — a
170.6% total return.Buy-and-hold outperformed the "golden cross" strategy by more than 30 times over.
No Backtrader class, no manual loop through six years of daily bars, no hand-rolled equity curve calculation. One sentence, and the
strategy's entire track record came back — including the fact that it lost badly.
Ask why it lost so badly
🟧 PROMPT
Break down the returns during each period
the strategy was out of the market,
to see what it missed.
Between each sell signal and the next buy signal — the stretches spent in cash, waiting for a new uptrend to confirm — AMZN moved:
Apr 2021: +2.9% (brief, minor)
Jan 2022 – May 2023: −14.2% (the strategy correctly avoided this stretch)
Apr–Jul 2025: +26.7% (missed entirely, sitting in cash)
Mar–May 2026: +29.3% (missed entirely, sitting in cash)
The strategy did its job during the one genuine bear stretch — sidestepping a 14% decline. But the other three times it sat out, the
stock wasn't falling, it was recovering fast — and a moving-average crossover, by design, only confirms a new uptrend after it's already
well underway. Two rallies worth more than 25% each happened entirely while the strategy was waiting for confirmation that never came in
time.
A word of honesty
This backtest, like most quick ones, simplifies reality in ways worth naming.
It ignores transaction costs and taxes — eight trades over six years isn't expensive, but it's not free either, and the comparison to
buy-and-hold (zero trades) is already generous to buy-and-hold before costs are even considered. It also tested exactly one stock over
exactly one stretch of history; a 50/200-day crossover might behave completely differently on a different asset, a longer history, or a
market that chops sideways instead of trending hard in one direction, which is the environment crossover strategies are actually
designed for. AMZN's pattern here — long, powerful trends with sharp V-shaped recoveries — is close to the worst-case scenario for a
strategy that only confirms a trend after it's already moved.
None of that changes what happened on this specific test. It's a reminder that "backtested it once" and "proved it works" are different
claims — the same reminder Backtrader would have given you, just after considerably more setup. As always: not investment advice.
Final Thoughts
This is the twenty-fifth article in the series Unlock Real-Time Market Intelligence with EODHD and Claude, and the one that finally tested what this whole
series has been implying: that a plain-English prompt can replace not just a data fetch, but the code around it too. Six and a half
years of daily bars, eight signals, a full equity curve — no Backtrader class, no manual loop.
Two prompts ran the backtest and then explained exactly where it went wrong.
So here's what those two prompts found: buy-and-hold turned $10,000 into $27,058. The golden cross strategy turned it into $10,527 —
more than 30 times less growth, mostly lost across two rallies, worth 27% and 29%, that happened entirely while the strategy sat in cash
waiting for confirmation. The code that used to take an afternoon to write took two sentences to run. The lesson it revealed — that a
famous strategy can lose badly to doing nothing — was exactly the same either way.
If this made you curious, the MCP Server is free
to try — The Setup walks you
through it.
← Part 24: Max Pain: A Real Pattern or a Coincidence With a Good Story?
Top comments (0)