All posts

Product5 min read

Agentic Backtesting: Prove Your Setup Before You Risk a Dollar

TerraTrade's backtesting now has an AI agent beside your chart. It marks the levels, checks your entry, and shows what your setup would have made.

By TerraTrade Team

Agentic backtesting. Prove your setup first. TerraTrade new feature cover

Most traders find out whether a setup works the expensive way: by trading it with real money and watching the account. Backtesting is supposed to fix that, but on your own it's slow, it's easy to fool yourself, and nobody is there to ask "wait, is this actually a good entry?"

Starting today, backtesting in TerraTrade comes with an AI agent that sits beside your chart. Replay any day of the market and trade it like it's live. Ask the agent if your entry holds up: it reads the chart with you, marks the levels, lays out the trade, and shows you what your setup would have made. We call it Agentic Backtesting.

What the agent does for you#

Open any backtest session and there's an Agent tab next to your chart. Talk to it like you'd talk to a trading buddy who has been watching the same screen.

  • "Is this a good entry?" It looks at the candles and the key levels before it answers, and it tells you what it looked at, so you can check its work.
  • "Mark the levels." It draws them right on your chart: yesterday's high, low, and close, the overnight and premarket ranges, the volume POC and value area, and recent swing highs and lows. Its lines are tagged ⟡ so you can tell them from yours, and one tap undoes any of them.
  • "Propose a trade." It lays the trade out as a card: entry, stop, target, R:R, and how many dollars you'd have at risk. You can confirm it, change it in the order ticket, or dismiss it.

It can also add or tweak your indicators, switch timeframes, and move the replay forward or back. Three quick buttons sit above the chat for the things you'll ask most: Explain this candle, Mark the levels, and Propose a trade.

The important part: the agent never takes a trade on its own. Every trade it suggests waits for you, and so does every jump forward or backward in the replay. You're still the trader. It's the second set of eyes.

It can't see the future#

The fastest way a backtest lies to you is hindsight. You already know where the market went, so the "obvious" entry looks obvious. An AI that could peek ahead would be worse: it would sound confident because it read the answer key.

So the agent only sees what you've already replayed. If the replay is sitting at 10:45, the agent sees the chart up to 10:45 and nothing after it, and a candle only counts once it has closed. Its read on your setup is exactly as honest as yours has to be.

Blind mode stays blind, too. In a blind session the agent still helps, but it never sees the date or the ticker, so neither of you can lean on remembering what happened that day.

Turn your setup into rules (Ultra)#

On Ultra, the agent can go one step further. Describe your setup in plain English and it writes it as code, or you can write it yourself in Python. Then test it on the same days you've been replaying.

Say your setup is "buy a close above the premarket high, stop at the premarket low, target 2R." The agent turns that into a short strategy file, something like this:

pm = self.levels and self.levels["premarket"]
if pm and ctx.position().qty == 0 and bar.close > pm["high"]:
    risk = bar.close - pm["low"]
    ctx.buy(bar.symbol, 1, stop_loss=pm["low"], take_profit=bar.close + 2 * risk)

Hit run and you get the answer that matters: what would this have made? Each test shows up in a Runs tab under your chart with the number of trades, net P&L, win rate, profit factor, and biggest drawdown. From there you can:

  • Plot the trades on your chart and see every entry and exit where it happened.
  • Open the full report: equity curve, drawdowns, a Monte Carlo simulation of the same trades, robustness checks, and trade-by-trade analytics.
  • Ask the agent what to change. "Most of the drawdown comes from trades held past 11:30. Want me to add a time stop and run it again?" is the kind of answer you'll get.

Tests follow the same no-hindsight rule as the agent. A test only uses the part of the market you've already replayed, so a strategy can't cheat by reading bars you haven't seen. Blind sessions never run code at all, because a test would give away the ticker and the dates.

When you want room to build, one click goes full screen: your files on the left, the code and its output in the middle, the agent on the right. Your chart stays exactly where you left it, and Esc takes you back to the replay.

Same fills as the trades you place yourself#

A trade you confirm from the agent fills exactly like one from the order ticket: same engine, same risk limits.

That engine was built not to flatter you. A stop that gets gapped through fills at the open, against you. If one bar hits both your stop and your target, it assumes the stop hit first by default. Prop-firm style daily loss limits and drawdown breakers block new trades once you hit them. And every closed trade lands in your backtesting journal like a real one, kept completely separate from your live stats.

Which plan gets what#

EssentialProUltra
Monthly price$29$49$89
AI agent on your chart—✓✓
Turn your setup into code and test it——✓
Runs tab, full report, plot trades——✓
Full-screen coding workspace——✓
AI credits / month1,0004,00010,000

The agent runs on the same AI credits as TerraAI, so there's no separate add-on. Essential shows the Agent tab with a lock; backtesting itself (10 sessions, 10 strategies) is on every plan.

A simple routine to prove a setup#

A routine that doesn't take all weekend:

  1. Pick 20 days your setup could have shown up. Turn on blind mode if you can; it keeps your memory out of it.
  2. Trade each day with the agent. Ask it to mark the levels first, write your plan, then ask whether your entry holds up. Confirm the trade, or skip it and note why.
  3. Read the session back. Every close is journaled, so you can see your win rate, your average R, and the habits that cost you.
  4. On Ultra, turn it into rules. Have the agent write your setup as code and test it over the same days. If the rules beat your discretionary trades, that's worth knowing. If they don't, that's worth knowing too.

Twenty trades won't prove an edge on its own; here's how many trades you actually need before you trust the numbers. But it will tell you fast whether a setup deserves more of your time, before it gets any of your money.

Questions you might have#

Does the agent place trades for me?

No. It proposes trades as cards and waits. Nothing gets placed unless you confirm it, and it asks before it moves the replay forward or back.

Can it cheat by looking ahead?

No. It only sees what you've already replayed, and a candle only counts once it has closed. Strategy tests on Ultra follow the same rule.

Do I need to know how to code?

No. On Pro there's no code at all: you chat with the agent on your chart. On Ultra, describe your setup and the agent writes the code for you.

Which markets does it work on?

The same 14,000+ stocks, futures, forex, and crypto instruments you can already backtest in TerraTrade.

Your journal writes posts like this about you.

Connect a broker and TerraTrade turns your own trades into the findings that matter.