How to Build a Trading Strategy One Test at a Time
The best way to learn the Vertex strategy builder is to build something, test it, and let the result decide what you change next. In this guide you'll start with one rule and grow it into a gold strategy, one prompt at a time.
We share the prompts rather than a finished strategy, because the process is what you'll keep. Every version we tested is here, including the ones that lost money. None of them is a recommendation to trade.
Before you start
Turn on the Vertex Robots connector in Claude and paste the prompt below. Then work through the steps in order. Each step has the same shape: a prompt to paste, what we got, what it taught us, and something to try yourself before moving on.
The whole journey uses about 35 test runs from your plan's monthly allowance. If you use the same dates, your figures should be close to ours.
You're helping me build and test a gold trading strategy in the Vertex strategy builder, one step at a time, using the Vertex Robots connector. This is a learning exercise. Don't recommend the strategy or predict how it will do. Report every result plainly, losses included. After each step, stop and wait for me. Write each strategy definition yourself from what I describe, and check it with validate_strategy before saving it. Each time I change the strategy, save it as a new version with save_strategy_version.
All tests: instrument XAU_USD, 5-minute candles, starting balance 100000, spread 0.3, ending 2026-08-01, unless I say otherwise. For every test report: net profit, return %, max drawdown %, peak margin utilisation, trades, win rate, profit factor, and whether the account was margin closed out, with the date if it was.
Step 1: Start with one rule
Gold tends to snap back after an extreme move, or so the idea goes. RSI measures how far and how fast price has moved, so the simplest possible strategy buys when RSI is low and sells when it's high. We call this version RSI.
Call list_building_blocks and read it. Then build my first strategy and call it "RSI". Buy when the 14-candle RSI is at or below 30, and sell when it's at or above 70, on 5-minute candles. Size each position at 0.1 oz per $1,000 of balance, scaling smoothly with the balance, and don't open anything new below a $1,000 balance. Close each position at 50 points of profit, with no stop loss. Allow one buy and one sell at a time: build it as a ladder with a lot exponent of 1 and a grid step of 100000000 points, so it never adds. Check it with validate_strategy, save it with create_strategy, and explain in plain words what each part of the definition does. Then test it from 2026-02-01, 2025-08-01, 2024-08-01 and 2022-08-01.
| Period | Net result | Win rate | Max drawdown |
|---|---|---|---|
| 6 months | +$4,553 | 93.1% | 8.5% |
| 1 year | -$17,308 | 87.4% | 18.7% |
| 2 years | -$22,669 | 85.2% | 23.5% |
| 4 years | -$27,210 | 80.8% | 27.4% |
What it taught us: a high win rate proves nothing. This version won more than 80% of its trades and still lost money over every period longer than 6 months. Six months alone would have looked like a success. The win rate only counts closed trades. The loss sits in the positions still open at the end of each test, because there's no stop loss to close them.
Try it: change the RSI levels to 25 and 75. Do fewer trades help, or do they just lose more slowly?
Step 2: Add to losing positions
With no stop loss, the trades that went wrong just sat open. A grid adds another position each time price moves further away, which pulls the average entry closer to the current price. We call this version RSI grid.
Change the strategy and call this version "RSI grid". If price moves another 50 points against an open position, add another position of the same size, and keep adding for as long as it keeps moving. Close all the positions in a ladder together, 50 points from their average entry. Save it as a new version and test it from 2024-08-01. Tell me the deepest ladder it reached.
Over 2 years the account was margin closed out on 22 Apr 2025, at -$45,458. It had up to 57 positions open at once.
What it taught us: adding positions of the same size barely moves the average entry once a ladder is deep, and it can take dozens of positions to get there. You also need to watch margin now, not just profit.
Try it: change the grid step from 50 points to 200. Does the ladder stay shallower, and does the closeout move?
Step 3: Make each position larger
If each new position is larger than the last, the average entry moves faster and a small bounce can close the whole ladder. This is called martingale sizing, and this version is the RSI martingale grid.
Change the strategy and call this version "RSI martingale grid". Make each added position 1.6 times the size of the last. Save it as a new version and test it from 2026-02-01, 2025-08-01, 2024-08-01 and 2022-08-01. Explain in two sentences what peak margin above 100% means. Use these limits: above 100% the broker refuses new trades, and the account isn't margin closed out until 200%.
What it taught us: the biggest positions are open exactly when price is furthest against them. There's no stop loss and no cap on levels, so the realistic worst case is losing the whole account. Lengthening the test doesn't avoid the failure, it just finds a different one.
Try it: set the lot exponent to 1.3. Does a gentler ladder survive, or does it fail on a different date?
Step 4: Stop fighting the trend
The closeouts above came from ladders that kept adding against a sharp move. So the next change is one rule: don't open a ladder against the longer-term trend. We measure the trend with a 200-candle EMA, so this version is EMA200.
Add a trend filter and call this version "EMA200". Don't open a new ladder against a 200-candle EMA of the strategy's own candles: block a buy when the close is below the EMA, and a sell when it's above. Record the reason as "counter-trend entry suppressed". Positions added to a ladder that's already open ignore the filter. Make the EMA period and the lot exponent settings I can change. Save it as a new version and test it from 2026-02-01, 2025-08-01 and 2024-08-01. Line up the 2024 run against the same period from the last version with compare_backtests. Use get_decisions on the 2026 run to count the blocked entries, and tell me how many fell between 1 and 19 March 2026.
What it taught us: check why a change worked, because a good result can be luck. Over the 6-month test the decision log shows 2,805 blocked entries, about 97% of the RSI signals. From 1 to 19 March 2026, the sell-off that wiped out the last version, it blocked 280 entries, and 189 of them were buys.
Try it: allow buys only. Does the result still hold when gold isn't rising?
Step 5: Treat the EMA period as a risk dial
EMA200 blocks most of its signals, so it trades rarely. A longer EMA blocks fewer entries. You can test that without changing the definition, because the period is a setting. The 1,000-candle version is EMA1000.
Without changing the definition, run EMA200 from 2024-08-01 with the EMA period set to 500, then 1000. Compare all three. Tell me how profit, drawdown and peak margin move as the period gets longer. Save the 1000 setting as a new version called "EMA1000".
| EMA period | Entries blocked | Net result | Max drawdown | Peak margin |
|---|---|---|---|---|
| 200 | 97.4% | +$26,314 | 18.0% | 100.6% |
| 500 | 91.9% | +$112,122 | 52.1% | 151.4% |
| 1,000 | 88.2% | +$185,118 | 52.0% | 182.3% |
What it taught us: a longer EMA doesn't filter better. It lets more of the original risk back in. More profit came with a drawdown three times larger, and peak margin moved much closer to the closeout line.
Try it: test a period of 300. Where does the drawdown jump?
Step 6: Try a slower trend, and watch it fail
Instead of a longer EMA, you could measure the trend on slower candles. This version keeps 5-minute candles for trading and uses a 400-candle EMA on 4-hour candles. We call it H4 EMA400.
Try measuring the trend on slower candles, and call this version "H4 EMA400". Use a 400-candle EMA on 4-hour candles, and keep 5-minute candles for everything else. Save it as a new version and test it from 2026-02-01, 2025-08-01, 2024-08-01 and 2022-08-01. Tell me the closeout date on each.
| Period | Net result | What happened |
|---|---|---|
| 6 months | -$59,263 | Margin closed out, 19 Mar 2026 |
| 1 year | -$35,733 | Margin closed out, 19 Mar 2026 |
| 2 years | +$16,272 | Margin closed out, 19 Mar 2026 |
| 4 years | +$102,519 | Margin closed out, 19 Mar 2026 |
What it taught us: a positive net result can hide a closeout, so read that column first. Every test here ended on the same day, however long it ran. We tested this version further on practice accounts, and you'll see how that went in Step 9.
Try it: test a 200-candle EMA on 4-hour candles. Does a shorter trend avoid 19 March?
Step 7: Tune on one period, judge on another
Back to EMA1000. It's tempting to try every setting and keep the best, but a setting that looks best on the period you tuned it on is usually just tuned to that period. A sweep protects you: it tests every value and ranks them only on a period it didn't tune on.
Go back to EMA1000 and tune the lot exponent without fooling myself. Call run_sweep with a grid of lot exponents 1.4, 1.5, 1.6 and 1.7. Use 2024-08-01 to 2025-08-01 as the tuning period and 2025-08-01 to 2026-08-01 as the held-back period. Follow it with get_sweep and rank on the held-back period only. Show me the tuning figures beside it, and flag any value that closed out in either period. Point out any cliffs: neighbouring values where one survives and the next is closed out.
In our sweep, 1.7 ranked first on the held-back period (+$139,909), but it was closed out in the tuning period (-$33,522). 1.4 did the reverse: it made +$26,797 in the tuning period and was closed out in the held-back one (-$39,527). So don't stop at the ranking.
We also ran a wider sweep of the lot exponent over 4 years, restarting after each closeout:
What it taught us: look at the neighbours. Only 1.5 and 1.6 survived, and 1.4 and 1.7 on either side did not. A result is more believable when nearby values behave alike, and here they don't. Starting size has a cliff too: on EMA200, 1.5 times the default survived 2 years (+$32,173), and 1.75 times was closed out (-$68,928).
Try it: sweep the take profit instead. In our tests, moving it from 10 to 150 points changed the 2-year profit by at most $6,634. Not every setting is worth tuning.
Step 8: Stress test what's left
Passing several test periods isn't enough. Now run each version over the longest history you can, and change the costs and the balance.
Stress test the versions. Run EMA1000 from 2022-08-01, 2020-08-01 and 2016-09-01, then from 2024-08-01 with spread 0.5, with starting balance 10000, and with starting balance 1000. Run EMA200 from 2020-08-01 and 2016-09-01. Run H4 EMA400 from 2020-08-01. Tell me if any result changes from profit to loss or ends in a closeout. Say plainly which versions held up.
| Version | 6 years | 10 years |
|---|---|---|
| EMA200 | +$49,807, no closeout | +$57,139, no closeout |
| EMA1000 | -$63,760, closed out 29 Sep 2021 | -$56,401, closed out 29 Sep 2021 |
| H4 EMA400 | -$60,702, closed out 29 Sep 2021 | Not tested |
What it taught us: EMA1000 passed every test up to 4 years, then failed the first test that reached back to 2021. None of the shorter tests could have caught it, because they all started later. EMA200 made far less and survived all of it, with an 18% drawdown. That's the trade-off you've been measuring since Step 5.
Costs and balance mattered less. Over 2 years, a 0.50 spread cut EMA1000's profit from +$185,118 to +$155,039. It behaved about the same at $10,000 and $1,000 (+$18,488 and +$1,822).
Try it: take your own favourite version and run it from 2016. If it fails, find out which date and what gold did that week.
Step 9: Run it on a practice account
The last step runs a version on a broker practice account with practice money. It uses the same strategy version you tested. Claude can't put a robot on a live account; going live is done in the Vertex Robots app.
Call list_practice_accounts and show me the accounts. After I pick one, and confirm the version and settings, call deploy_practice_robot with them. Then show the robot's status with get_robot. Only ever use a practice account. Never call request_live.
Results from our own practice robots, as of 2 Nov 2026, in each account's own currency:
| Robot | Running since | Result |
|---|---|---|
| EMA1000 | 29 Sep 2026 | +$8,451 (+8.4%) on $100,000 USD, no trades open |
| H4 EMA400 | 20 Aug 2026 | -41.9% (AUD) |
| H4 EMA400 | 28 Aug 2026 | -53.0% (USD) |
| H4 EMA400 | 14 Sep 2026 | -55.3% (JPY) |
| H4 EMA400, $1,389 AUD account | 18 Aug 2026 | -74.2% (AUD) |
What it taught us: five weeks on one account says very little about a strategy whose failures come months or years apart. All four H4 EMA400 robots lost heavily in their first weeks. We show both because a single good result on its own would be misleading. Use a practice account to check that the robot behaves as the backtest said it would, not to prove that it makes money.
The loop you just learned
Every step followed the same loop, and it works for any strategy you build:
- Change one thing. Save it as a new version so you can compare.
- Test it on several periods. Then go longer than feels necessary.
- Read the risk figures first. Check closeouts, drawdown and peak margin before profit.
- Check the mechanism. Use the decision log to confirm why the result changed.
- Test the neighbours. A setting whose neighbours fail is standing near a cliff.
- Decide, then go back to step 1. Keep the change or drop it, and write down why.
Now make it your own. Try a different instrument, a different entry rule or a new veto, and run the loop again. Decide in advance how large a drawdown you'd accept, rather than after you see the results. We'd also test a falling and a sideways market early: most of our periods sit inside gold's rise from 2022 to 2026.
Important information
This guide is general information and education about using the Vertex strategy builder. It is not financial advice or a recommendation to trade gold, to use any strategy in it or to use any robot. It doesn't take into account your objectives, financial situation or needs. Vertex Robots is software that you run on your own broker account. We don't manage money or trade on your behalf.
Trading gold and other leveraged products carries a high risk of loss, including losing more than your account balance where your broker allows it. The strategies in this guide use martingale sizing, which can lose an entire account in a single sustained move. Backtested and practice-account results are hypothetical. They don't account for every real trading cost or condition, and past or simulated results don't predict future results. Consider getting independent advice before trading with real money.