Backtest(英文原版)

SharpTrader™ Arbitrage 官方文档 · 中文整理版 · 英文原页 ↗

The Backtest module (SharpTrader Optimizer) lets you test a strategy on stored historical ticks and search for the best parameter values before running it live. It works with the built-in arbitrage strategies and with your own C# bots written in the Coding module: the same strategy code runs live, in a backtest and in an optimization.

Product page and license: SharpTrader Optimizer.

Video: SharpTrader Optimizer Explained (Real Tick Backtesting & Strategy Optimization Guide 2026)

Two modes

Mode What it does Use it to
Backtest Runs one set of parameters over a selected date range. Shows the equity curve, every closed order (ticket, time, type, lots, price, P/L), results by direction and by hour of day. Check a single configuration, debug strategy logic, prepare a report.
Optimization Runs every combination of the parameter ranges you set (grid search) and ranks the results by PnL or drawdown. Find stable parameter regions, compare execution-time scenarios, do walk-forward checks.

A typical workflow: run an optimization to find candidate ranges, then backtest the best few combinations one by one and look at the shape of the equity curve and the drawdown.

Before your first backtest

How the simulation works

Choosing the execution time

Use the round-trip time you actually see on your setup. As a rough guide: 5–20 ms for co-located institutional setups, 30–60 ms for a fast bridge VPS, 80–180 ms for a typical retail VPS, 200 ms and more for a poor connection.

Run the same parameters at 0 ms (upper limit only, not realistic), about 50 ms and about 150 ms. If the result collapses between 50 and 150 ms, the strategy is very sensitive to latency and will likely suffer from a slower broker or VPS. Never pick final parameters from a run at 0 ms.

Backtesting a custom bot

  1. Add your custom strategy to the Backtesting window.
  2. Open the strategy settings and select the symbols to test on the Backtesting tab.
  3. Set the date range and the execution time, then start the test.

All indicators of the bot API (IIndicators) work in backtests: trend, bands and channels, oscillators, volume and moving averages, for example Ichimoku, SuperTrend, Bollinger and Keltner bands, Parabolic SAR, Stochastic RSI, Aroon, VWAP, Hull MA and KAMA. They are fast enough to call on every tick; index 0 is the newest bar. If there are not enough bars, an indicator returns null and getLastError() explains why.

See also: Bot Code Example, AI Assistant.

Optimization

Example: Latency Arbitrage parameters

For Latency Arbitrage the most useful parameters to optimize are Diff to open, Min profit, Pips for Min profit, Trail distance, S/L, T/P, Max Spread Slow and Max Spread Fast. The newer columns Min move, Trend interval, Cooldown and Reverse factor % can also be included. Start with coarse steps and narrow the ranges around the best region.

How long does it take

Run time grows with the number of combinations, the length of the tick history and falls with the number of CPU cores. As a reference, about 30,000 combinations on one week of XAUUSD ticks take roughly 12 hours on a 4-core CPU and about 3 hours on a 16-core CPU. For grids of 100,000+ combinations over several months of ticks use an 8–16 core machine with 32 GB RAM and an SSD.

Analysing the results

Related pages

← 表现图表交易和手动交易 →