Explore more topics
Technical indicators

How to build a trading strategy with technical indicators

Build a technical-indicator strategy step by step, worked through a real backtest against SPY: QQQ above its 200-day average, otherwise short-term Treasuries.

Jump to a section

QQQ above its 200-day average, otherwise short-term Treasuries

Value (%)

QQQ above its 200-day average, otherwise short-term Treasuries against SPY, percent from the first day, Oct 2021 – Sep 202690.5%-19.9%2021-10-012026-09-30
Strategy 2026-09-30
59.51%
SPY 2026-09-30
88.51%
StrategySPYHistorical simulation
Test window
Oct 2021 – Sep 2026
Starting balance
$100,000
Fee per trade
0.1%
Benchmark
SPY

This is the result. The four steps below show how the strategy was built and tested.

1. Describe the idea to Aurora

A prompt like this one describes the strategy in plain English.

“Build a portfolio that follows these rules. Hold QQQ while QQQ's price is above its 200-day simple moving average. Hold SHY (1-3 year Treasuries) while QQQ's price is at or below its 200-day simple moving average. Trade only when the signal flips: buy QQQ only when no QQQ is held, buy SHY only when no SHY is held. Each side is 100% of the portfolio. Backtest it between Oct 1, 2021 and Sep 30, 2026 with $100,000 to start, a 0.1% fee on each trade, SPY as the benchmark.”

2. Check the rules Aurora writes

These are the exact rules the backtest ran.

  1. Rule 1

    Hold QQQ while QQQ's price is above its 200-day simple moving average.

  2. Rule 2

    Hold SHY (1-3 year Treasuries) while QQQ's price is at or below its 200-day simple moving average.

  3. Rule 3

    Trade only when the signal flips: buy QQQ only when no QQQ is held, buy SHY only when no SHY is held.

  4. Rule 4

    Each side is 100% of the portfolio.

3. Backtest it against SPY after fees

It switched 61 times around the 200-day average, and fees of $13,695 at 0.1% per trade added up.

Strategy return
+59.5%
SPY return
+88.5%
Largest fall
−29.2%
Sharpe ratio
0.68
Closed trades
60
Fees paid
$13,695

4. Test it on dates it never saw

Next, run a walk-forward test, which freezes the rules and checks them on later dates they never saw. See a walk-forward test on unseen dates

The results describe historical observations. They do not establish live trading performance.

Continue exploring