# Trading Strategy Backtest Excel Model

Replay a trading rule on past prices with real costs and cash limits. The model tracks every trade, then reports return, drawdown, turnover and results against a benchmark.

- Canonical: https://finamodel.com/templates/historical-investment-strategy-backtest
- Excel download: https://finamodel.com/templates/historical-investment-strategy-backtest.xlsx
- Category: Capital Markets
- Model type: Portfolio
- Difficulty: Intermediate
- Audiences: Investors & analysts, Fund managers, Systematic and quantitative traders, Portfolio managers testing trading rules, Investment analysts reviewing strategy ideas, Finance students learning backtesting
- Tags: backtest, trading-strategy, moving-average, drawdown, systematic-trading

## Overview

A model that backtests a long-only moving average crossover strategy. The starting case is a fictional systematic equity strategy with $250,000 of starting cash and 180 daily bars of adjusted open, close and benchmark prices. You set the entry allocation, fast and slow averages, commission, slippage and a fixed fee per order.

Signals use only prior closes and trade at the next open, so there is no look-ahead. Entries buy whole shares after costs and exits sell the full position. A ledger tracks shares, cash, equity, cost basis and realized profit, and blocks any trade that cash cannot fund. Other sheets show daily performance, a filled-order log, a drawdown review and results for three historical windows.

In the case the strategy returns -0.53% against 6.72% for the benchmark, with maximum drawdown of -4.63%, ten filled orders and gross turnover of about 9.5 times. Fees and slippage cost $1,454. A checks sheet tests cash and share rollforwards, the equity to profit bridge, negative cash and duplicate dates.

## What's included

- Daily price table with adjusted open, close and benchmark close
- Fast and slow moving average signals built from prior closes only
- Whole-share position sizing with an entry allocation
- Commission, adverse slippage and fixed fee per order
- Trade ledger with cash, shares, equity, cost basis and realized profit
- Cash check that blocks trades that cannot be funded
- Total and annualized return, volatility, drawdown and turnover
- Excess return against a benchmark index
- Filled-order log and drawdown episode review with charts
- Results for three historical windows
- Checks for cash, shares, equity bridge and duplicate dates

## Honest backtest rules

Signals use only past closes and trade at the next open. Costs are charged once and cash can never go negative, so results are not flattered.

## Every trade on record

The ledger shows each day's signal, shares, cash and equity. The trade log lists every fill with price, fee and cash after the trade.

## Results by period

Split the sample into windows to see if the strategy works in all periods. The drawdown review shows the worst peak to trough episode.

## Workbook structure

### Summary

Strategy results against the benchmark.

- Total and annualized return
- Volatility and maximum drawdown
- Turnover, orders and fees

### Ledger

Daily trade and position record.

- Signal, fill price and trade shares
- Cash, equity and cost basis
- Affordability check

### Performance

Daily returns and drawdown.

- Net and benchmark returns
- Peak equity and drawdown
- Turnover

### Signals

Moving average signals.

- Prior fast average
- Prior slow average
- Target signal

### Prices

Source price series.

- Adjusted open and close
- Benchmark close
- Source issue flags

### Assumptions

Strategy and cost controls.

- Initial cash and allocation
- Average lengths
- Commission, slippage and fees

### Trades

Filled-order audit.

- Signal and execution dates
- Shares and fill price
- Fee and cash after trade

### Review

Cost and drawdown review.

- Winners, losers and holding days
- Drawdown episode
- Equity charts

### Checks

Rollforward tests.

- Cash and share differences
- Equity to profit bridge
- Window reconciliation

### Replay windows

Results by historical window.

- Return and excess return by window
- Window drawdown
- Exposure and slippage

## Frequently asked questions

### What is a trading strategy backtest?

A backtest applies a trading rule to past prices to see how it would have performed. It records each trade, cost and position. The results show return, risk and how the rule compares with simply holding a benchmark.

### How does the model avoid look-ahead bias?

The moving averages use only closes before the current day. A new signal trades at the current day's open. No future price is used to decide a trade.

### What happens if cash is too low for a trade?

The model checks cash before each trade. If the trade cannot be funded, it is rejected with no fee and the prior position and cash stay in place. The blocked count is shown on Assumptions.

### What is not included?

The model is long-only with no leverage, short sales, taxes, borrow costs or interest on cash. Prices are fictional, and past results do not predict future performance.

### Can I test other settings?

Yes. Change the averages, allocation and costs on Assumptions, or paste your own prices on the Prices sheet. If you add more bars, extend the formula ranges.

## Related templates

- [Equity Portfolio Analysis](https://finamodel.com/templates/equity-portfolio-model)
- [Hedge Fund Operating Model](https://finamodel.com/templates/hedge-fund-model)
- [Monthly Return Seasonality Study](https://finamodel.com/templates/finawork-020-historical-return-seasonality-study)
