Skip to main content
← Back to blog

Does a Bitcoin strategy written by an AI hold up? We tested Codex, Claude and Grok

📅 Published
✍️ Strategy Arena
AI bitcoin pine script backtest judge research

Short answer: we sent the same prompt to three AIs, three times each: “write me a profitable Bitcoin trading strategy in Pine Script v5”. Codex and Claude wrote 6 scripts, almost all the same strategy: a channel breakout filtered by the 200 EMA, with an ATR stop and a size computed on risk. On BTCUSDT, the online judge judged 5 of them on 1D, 4h and 1h. None holds up. On 1D they trade too little on the sealed period to be judged; on 4h and 1h they stay below simply holding Bitcoin. The 6th script asks for other data (request.security) and is not judged yet.

Research on past data, not investment advice.

The test: one prompt, nine tries, nothing thrown away

On 7 November 2026 we sent this prompt, word for word, to three command-line AIs with their default model:

Write me a profitable Bitcoin trading strategy in Pine Script v5 for TradingView. Give me the complete code.

  • Codex CLI 0.166.0 (OpenAI, model gpt-6.1-sol), Claude Code 2.1.318 (Anthropic, claude-opus-5-5) and Grok CLI 1.0.70 (xAI, grok-4.7-build).
  • Three calls each, in an order fixed in advance. Every answer is kept, good or bad.
  • The protocol was written and hashed (SHA-256) before the first call.
  • Grok returned no code in this headless setting: plans, then attempts to write a file and test its rules online, which were blocked. This does not measure what Grok writes in its app.

The exact scripts are online, untouched, so you can paste them into the judge: claude-1, claude-2, claude-3, codex-1, codex-2, codex-3 (SHA-256 hashes).

What the AIs wrote: six times the same system

Element Scripts (out of 6)
breakout of a channel of highs (ta.highest) 6
stop computed with the ATR 6
size computed to risk 0.5 to 1% of equity 6
trend filter on a long moving average (200 EMA…) 5
date window 5
short sales, off by default 4
RSI, MACD or Bollinger 0

No AI proposed the indicators seen in every video, such as the RSI or the MACD. All wrote a classic “turtle”-style trend-following system: buy when price breaks its recent high, in an uptrend, with a wide stop and a small part of equity at risk.

The scripts are careful: 0.1% fees per order, slippage, a stop frozen at entry or one that only tightens, an exit when the trend breaks. They do not cheat on execution. The only question is whether the rule wins.

The judge's verdict

The online judge replays each script as written on Binance BTCUSDT candles. It keeps the last 20% under seal: the rule sees them only once, for the verdict.

  • 1D: from 2017 to October 2026, sealed period from 17 December 2024 to 16 October 2026.
  • 4h: 3 years, sealed period from 12 March to 17 October 2026.
  • 1h: 1 year, sealed period from 5 August to 17 October 2026.
Script 1D 4h 1h
Claude, try 1 too few trades (5) inconclusive: +4.87% mirage: +19.87%
Claude, try 2 too few trades (5) inconclusive: +4.71% mirage: +14.98%
Claude, try 3 too few trades (6) inconclusive: +3.12% mirage: +11.53%
Codex, try 1 too few trades (4) mirage: −0.94% mirage: +0.77%
Codex, try 2 too few trades (7) mirage: −1.05% mirage: +0.45%
Codex, try 3 not judged (request.security) not judged not judged
Holding Bitcoin, same period −23.26% +15.83% +27.14%

Returns on the sealed period, fees included.

How to read it: - On 1D, the rules open only 4 to 7 trades in 22 months. That is too few to tell a rule from luck: the judge asks for at least 10 trades. They did protect capital (from −3.3% to −0.04%) while Bitcoin lost 23%. - On 4h and 1h, all stay below simply holding Bitcoin. Even +19.87% stays below holding's +27.14%, and the statistical tests cannot separate that result from chance once the trials are counted. - This is not a ranking of AIs. Claude's scripts do better than Codex's over this period, but there is one day, one prompt, one market and three tries per AI.

What this test does not say

  • It does not say that no AI can write a strategy that holds up. It says that the default answer to this prompt, in November 2026, is not one on Bitcoin.
  • These scripts were not replayed in TradingView. The judge follows TradingView's execution model, checked on real cases, and says next to the verdict what it replays only approximately. For example, the size is measured from the next open, within 0.01% on 4h.
  • The 6th script reads the daily trend on a shorter chart (request.security). The judge does not replay it yet. It says so and lists what blocks.

Test the strategy your AI gave you

  1. Open the online judge and paste your AI's whole answer: the judge takes the code block itself.
  2. Pick the timeframe and run it. The computation runs in your browser; the script is not sent to the server.
  3. If the judge refuses, it lists every part it cannot replay, with its line. The “Copy the request for my AI” button prepares a rewrite request. Keep in mind that a rewritten script is another strategy.

A “mirage” verdict is not a failure of the test. It is the point: knowing, before risking money, that a nice result does not hold outside the data that produced it.

FAQ

Can an AI write a profitable Bitcoin strategy?

In our test of 7 November 2026, with the same prompt sent 9 times to Codex, Claude and Grok, none of the 5 strategies that could be judged held up on the online judge's sealed period, on BTCUSDT 1D, 4h and 1h. This does not prove that no AI can write one: one day, one prompt, one market.

Why do AIs write almost the same strategy?

The 6 scripts with code all use the same trend-following system: a breakout of a channel of highs, a trend filter on a long moving average (often the 200 EMA), a stop at 2 or 2.5 ATR, and a size that risks 0.5 to 1% of equity per trade. It is the most documented system in trading books and tutorials, which probably explains why it comes out by default.

What does “mirage” mean?

The rule loses on the sealed period, which the judge never showed it, or its result cannot be told apart from luck once the number of trials is counted. A gain can therefore be judged a mirage, if it stays below buy-and-hold or if the statistical tests cannot separate it from chance.

How do I test the strategy my AI gave me?

Paste your AI's whole answer into the online judge: it takes the code block itself. If it refuses, it lists every part it cannot replay, with its line, and offers a ready-made request to send back to your AI. The computation runs in your browser: the script is not sent to the server.

Does the judge reproduce TradingView exactly?

Its execution model was checked on TradingView (234 trades out of 234 on real cases). These 5 scripts were not run in TradingView. When the judge replays a detail only approximately (for example, a size measured from the next open rather than the signal close), it says so next to the verdict; certified mode refuses those approximations.

⚠️ Disclaimer — This article is for informational and educational purposes only. It does not constitute investment advice or a buy/sell recommendation. Past performance does not guarantee future results. Strategy Arena is an educational simulator with virtual capital. Always do your own research before making investment decisions.

Enjoyed this article? Share it

𝕏 Share on X ✈️ Telegram

Turn a local result into durable proof

The Lab runs free on your PC. Paid options only keep or expand the work — they never change the verdict.

Get the Lab (free) Builder / Operator Publish a Lab Report Lab Reports Hall
TradingView Starter
Choose the account path. Prove the strategy separately.
Your first chart and price alert do not require the Lab. Strategy Arena proof remains required before trusting or exporting a strategy.
Partner attribution is for first-time users and web purchases only. Strategy Arena may earn a commission on eligible purchases; starting with a free account needs no payment.
I have never had an account · Start free I already have an account Check a strategy
More TradingView paths
Evidence-gated Pine review