Getting Started with the Playground
This guide walks you through running your first algorithmic backtest. By the end, you will have executed a strategy against real historical data and seen the results on an interactive chart.
Prerequisites
- A TestMax account with an active Pro subscription
- A modern web browser (Chrome, Firefox, Safari, or Edge)
- No local Python installation required — strategies run on the server
Your first backtest
-
Open the Algo Playground
Navigate to the Playground page from the main sidebar. You will see the configuration panel on the left, a chart area in the center, and the output/code/trades panel at the bottom.
-
Select an instrument
Use the Instrument dropdown to pick a futures contract. For your first run, select NQ (Nasdaq 100 E-mini). Other available instruments include ES (S&P 500), GC (Gold), CL (Crude Oil), and EURUSD.
-
Set the date range
Choose a Start Date and End Date for the historical data. For a quick first test, pick a single day — for example,
2025-01-15for both start and end. A single day of 1-second data contains roughly 23,400 bars (6.5 hours of market data). -
Choose a timeframe
Select a Timeframe from the dropdown:
- 1s — One bar per second. Maximum resolution, most bars, slowest to process.
- 5s — Five-second bars. Good balance for scalping strategies.
- 1m — One-minute bars. Standard for most strategies.
- 5m — Five-minute bars. Faster execution, fewer signals.
- 15m — Fifteen-minute bars. Best for swing-style strategies over multiple days.
For your first run, start with 1m (one-minute bars). This gives a manageable number of bars while still showing meaningful price action.
-
Pick a strategy template
From the Template dropdown, select SMA Crossover. This is a classic trend-following strategy that buys when a fast moving average crosses above a slow one, and sells when it crosses below.
You will see the template’s configurable parameters appear below:
- Fast Period — Default:
10. The number of bars for the fast moving average. - Slow Period — Default:
30. The number of bars for the slow moving average. - Max Bars — Default:
0(unlimited). Limits how many bars the strategy processes. Leave at 0 to process all available bars.
Leave the defaults for now — they work well for a first run.
- Fast Period — Default:
-
Set the playback speed
Use the Speed control to set how fast the backtest runs. Options range from 1x (real-time, one bar per second delay) to 100x (near-instant). For your first run, set it to 10x so you can watch the chart build up without waiting too long.
You can change the speed while the backtest is running.
-
Click “Run Backtest”
Hit the Run Backtest button. Here is what happens:
- The server creates a replay session for your selected instrument and date range.
- Your Python strategy script begins executing on the server.
- A WebSocket connection opens between your browser and the server.
- Candles appear on the chart one by one as the strategy processes each bar.
- Trade markers (green upward triangles for buys, red downward triangles for sells) appear when the strategy places orders.
- The equity curve updates to reflect your running P&L.
- The Output tab shows real-time log messages from the strategy.
-
Watch the execution
As the backtest runs, observe:
- The chart — Candlesticks build from left to right. Watch for the moving average crossover points where trades are placed.
- The output log — Shows
[INFO]messages for strategy status,[TRADE]messages for each buy/sell, and progress updates. - The account bar — Displays running balance, equity, P&L, and trade count at the top.
- The equity curve — The line chart below the main chart tracks your account balance over time.
You can adjust the speed up or down during execution. Click Stop at any time to halt the backtest early.
-
Review the results
When the backtest completes (or you stop it), the output log shows the final summary:
────────────────────────────────────────────────────────────[DONE] Backtest Complete![DONE] Final Balance: $50,245.00[DONE] Net P&L: +$245.00[DONE] Total Trades: 18[DONE] Win Rate: 55.6%Switch to the Trades tab at the bottom to see each individual trade with entry time, side (BUY/SELL), entry price, exit price, and P&L.
Understanding the output
The output log uses prefixed tags to categorize messages:
| Prefix | Meaning | Example |
|---|---|---|
[INFO] | Status and configuration messages | [INFO] Strategy: SMA Crossover (fast=10, slow=30) |
[TRADE] | Trade executions | [TRADE] BUY @ 21503.25 | Fast MA: 21502.10 > Slow MA: 21500.85 |
[ERROR] | Errors during execution | [ERROR] API Order/place: 400 Invalid size |
[DONE] | Final results summary | [DONE] Net P&L: +$245.00 |
Tips for your first runs
- Start small. Use a single day and 1-minute bars before trying multi-day backtests on 1-second data.
- Try different speeds. Start at 10x to watch the strategy work, then rerun at 50x or 100x once you understand the pattern.
- Experiment with parameters. After your first run, change the Fast Period to
5and the Slow Period to20, then rerun. Compare the results. - Check the Code tab. Switch to the Code tab to see the full Python script that was generated. This helps you understand the strategy structure before writing custom code.
- Use the Trades tab. The trade log shows every execution with precise prices. Look for patterns — are most losing trades happening at specific times or conditions?
Next steps
Now that you have run your first backtest, here is where to go next: