Strategy testing

Strategy backtesting: fees, drawdown and validation

What a backtest measures, which costs to include and why an attractive equity curve is not enough.

What is a trading strategy backtest?

A backtest applies predefined trading rules to historical data. It reconstructs hypothetical trades and reports the outcome under chosen assumptions. It tests a hypothesis rather than forecasting returns. Binance Academy explains this definition and its limitations.

The practical question is: “If these rules and execution assumptions had applied during this period, which trades would they have produced?” Signals are only part of the answer. The price source, entry timing, position size and costs also affect the result. Compare two reports only after comparing their settings.

What to record before running a test

Create a short test specification. Another person should be able to reproduce the calculation from it.

  • Market: exchange, pair, spot market or specific contract.
  • Data: source, start and end dates, time zone, timeframe and missing intervals.
  • Rules: entry signal, exit, stop, re-entry and maximum simultaneous positions.
  • Capital: starting amount, reporting currency, sizing method and leverage assumptions.
  • Execution: when a signal becomes available, when a fill is simulated, order type, fees and slippage.
  • Version: strategy parameters and the date the specification was saved.

“Buy the breakout” is incomplete. Does a breakout mean touching a level during a candle or closing above it? If the signal uses the closing price, that price cannot also be assumed known before the candle ends.

Inspect the beginning of the dataset separately. Is there enough history to warm up the indicators? Decide how missing intervals are handled. Carrying the last price forward and excluding an interval are different assumptions. The chosen treatment should remain visible in the report.

How to account for fees and slippage

A fee is a charge for an executed transaction. Slippage is the difference between an assumed execution price and the actual or simulated fill price. Keep them separate. TradingView’s strategy properties distinguish commission from slippage and apply commission to entries and exits.

An arithmetic example: a hypothetical purchase has a value of 1,000 USDT and the sale has a value of 1,010 USDT. With an invented fee of 0.1% on each side, costs are 1 + 1.01 = 2.01 USDT. The 10 USDT price difference leaves 7.99 USDT before other costs. This is an illustration, not an exchange fee schedule or a Clerix result.

For your own report, use the fee applicable to your market and account tier. Record whether the model distinguishes maker and taker fills. Check funding separately for derivatives and borrowing costs where funds are borrowed. Avoid a single unexplained allowance for every expense: each cost needs a clear calculation basis.

Save a baseline scenario and a stricter execution scenario. For example, change only the slippage assumption and compare the outcomes. That experiment answers a specific question about model sensitivity; it does not establish a universally acceptable cost level.

What maximum drawdown means

Drawdown measures the decline in equity relative to its previous peak. At a particular point, the formula is: (previous peak − current equity) / previous peak × 100%. Maximum drawdown is the largest such decline in the series being examined.

In a hypothetical series, equity reaches 12,000 USDT and later falls to 9,000 USDT. The drawdown from that peak is 25%. Returning from 9,000 to 12,000 requires a gain of about 33.3%. The percentage decline and the percentage recovery are therefore different.

Check which series the report uses: closed trades only, or equity including the changing value of open positions. Also examine recovery time and losing streaks. Two reports with the same final balance can describe very different paths. The largest historical drawdown does not cap future losses.

How to check for overfitting

Repeatedly changing parameters until a chart looks attractive can select a configuration that describes noise in one period. The Pine Script documentation discusses overfitting, future-data leakage and testing on a separate sample as important evaluation issues.

We suggest the following workflow:

  1. Save the initial hypothesis and a record of variants already tested.
  2. Set aside a development period and a separate period that is not used to select parameters.
  3. Freeze the settings before testing on the second period.
  4. Examine nearby parameter values and different market periods, retaining unsuccessful results.
  5. Review several trades manually: available data, signal, size, price, costs and exit reason.
  6. Record the conclusion and next experiment, even if the hypothesis is rejected.

Once you adjust a strategy using the second period’s results, that period becomes part of development. A later test on it is no longer independent. No single trade-count threshold automatically proves that every strategy is robust.

What to do with the report

A useful output consists of a saved specification, trade log, assumptions and documented limitations. Then explore how paper trading differs from backtesting: incoming data tests a different set of questions. Use the AI strategy brief template to clarify your rules.

Before the next test, write down one question: what should it confirm or challenge? Save the answer alongside the report so later parameter changes do not silently replace the original hypothesis. Explore the path from an idea to rules and testing in Clerix.

Sources

Clerix Editorial

Clerix educational content on strategy rules, testing methods and the limitations of trading simulations.

Explore the Clerix workflow