Personal Notes

Terms

Backtest
Performance test on historical market data, which we hope is representative of future market data.
Drawdown Risk
The losses that you might incur in process of taking advantage using trading.
Limit Order Book
H
Electronic COmmunication Network
ECN

Backtesting Biases

Optimisation Bias
Tweaking too much to get it working with training data. Also known as Curve Fitting or Data Snooping.
  • Have less parameters and increase number of data points.
  • e.g. Surface response plot for parameter.
Look-Ahead Bias
Test data gets into the training data.
  • OHLC Data: Since these include data from ends of that period, they might include a bias as well if trading with finer details. Better to lag high/low values by at least one period to not get biases into the training process.
  • Survivorship Bias: Tested on datasets without full universe of prior assets. e.g. Only including assets that survived a crash like 2001 market crash.
    • Future derivatives of certain commodities are free from this bias.
Cognitive Bias
Your picture of annual returns might be lovely with 4 months of bad behavior. This looks good on a forecast but can affect in real world practice.

Exchange Issues

Order Types
Market Orders and Limit Orders
  • Market Orders: Executes a trade immediately. Aggressive orders.
  • Limit Orders: Strategy to determine worst price at which trade will executed and trade may not get filled partially or fully.
Price Consolidation
Orders can be sent to different exchanges based on broker and liquidity. Obtain data from the exchange itself rather than cheap composite feed which might create discrepancies between actual trading data and backtests.
Forex and ECN
Different venues can have different bid/ask prices. Use bid-ask quotes in backtests and be careful of variation.

Brokers working in python

  • Interactive Brokers (IBypy)