3 ยท Backtesting
Run your system over history โ and read the results with the scepticism they deserve.
A backtest replays your strategy bar-by-bar over historical data, filling orders through the broker's cost model and recording everything. It answers one question: if this exact system had run over this period, what would have happened? It does not tell you the future โ treat it as a way to reject bad systems, not to celebrate good numbers.
Run it
Quick Sim
For a single strategy, use Quick Sim from the strategy's controls. Malgot cleans up the previous run, creates a fresh execution, and streams live logs while it runs. One execution per Quick-Sim system keeps the workspace tidy.
Set the period, capital and broker
Choose the date window, starting capital, and a broker. The broker is not cosmetic โ its commission, slippage and (for shorts) borrow-fee settings change the result materially.
Open the result
When it completes you land in the Trading-State Detail view: the equity curve, metrics, observer plots, and paginated tables of signals, orders, trades and positions.
Read the result honestly
The equity curve is the least informative chart on the page. Look deeper:
- Metrics panel โ CAGR, Sharpe, max drawdown, win rate, profit factor, expectancy. A high CAGR with a brutal drawdown is not a good system.
- Trade distribution โ switch the Trades tab to the Histogram view and bin
PnL. If a handful of outlier trades carry the whole return, the edge is fragile. Do the same for holding time to see if your time-stop dominates. - PnL by symbol โ is the edge broad, or is it one lucky ticker?
- Observers โ does exposure behave as intended? Are you accidentally always short at the end?
Cash โ equity when you hold shorts
Short-sale proceeds inflate cash; the negative position value nets them out in equity. If cash looks far larger than equity, you almost certainly have open shorts โ the equity curve is the true account value.
The costs that quietly kill edges
Many "profitable" backtests are noise once realistic frictions apply. Verify each:
- Commission โ flat + percentage per fill, deducted from cash. On by the broker.
- Slippage / spread โ a slippage model turns the reference price into a worse fill. Small per trade; large over thousands of trades.
- Short borrow fee โ a daily financing charge on open shorts. Off by default
(rate
0). If your system shorts, set a realistic rate before you believe the return.
A backtest with zero costs is a fantasy
Turn costs on before you judge a system, not after. The rank order of strategies often changes once frictions apply โ the "best" gross system can be the worst net.
The cardinal sins
- Look-ahead โ filling on the same bar the signal is computed. Malgot fills resting orders on the next bar's prices for this reason.
- Overfitting to one period โ a single window is a single sample. A great 2019โ2021 result says little about 2022.
- Reading the mean, ignoring the tails โ the histogram exists precisely so you look at the shape, not just the average.
In Malgot today
execution_id, so runs never bleed into each other.
Next
One good backtest is one sample. The next four stages exist to find out whether that sample generalises โ starting by searching the parameter space properly.
