Chapter 1

Chapter 1

CHAPTER 1 OVERVIEW & BACKTESTING OVERVIEW There are two main strategies that will be covered in this book: Mean Reversion Belief that an asset will revert back to an equilibrium point Drawn from inter/intraday data of stocks, ETFs vs. their components, currency pairs, futures calendar/intermarket spreads Backwardation/contango with respect to futures contracts curves

Momentum Belief that an asset will continue its behavior 4 main drivers of momentum in stocks and futures Strategies based on news events, sentiment, leveraged ETFs, order flow, and HFT all will be covered in the book BACKTESTING AND AUTOMATED EXECUTION Backtesting is done in hopes that the historical

performance of a strategy will help us understand what to expect for future performance The profitability of a strategy (and therefore the effectiveness of a backtest) is extremely sensitive to changes in: 1. Order Type 2. The time that the order is placed 3. Using the bid/ask/last price to trigger a trade The author of a research paper cannot do out of sample testing within the research paper COMMON PITFALLS OF BACKTESTING AVOID AT ALL COSTS

LOOK-AHEAD BIAS When your algorithm is using information in the future to determine todays trading signals Example: using the closing price of today to determine the entry signal for todays trades Mitigate by using the same program for backtesting and live trading Cant make the same mistake live trading More common than you think! DATA SNOOPING BIAS

Caused by overfitting your model based on your training data May look great when testing but will likely look terrible with test data/OOS testing If your model doesnt quite meet your standards, DO NOT TWEAK IT to make it look better Easiest way to avoid this is to use cross-validation (i.e. use different subsets of the data before using your training data/test data) Make the model as simple as possible, with as few parameters as possible, and with as few rules as possible

STOCK SPLITS AND DIVIDENDS Some data sources may not account for stock splits and dividends in their price history Example: look up the 1M chart of $OZM on Apples stock app Usually there is an option on Bloomberg for dividend/split adjustments Yahoo finance also has dividend and split adjustments (and is free!) SURVIVORSHIP BIAS

Failing to include delisted stocks means that your model will suffer from survivorship bias Only including stocks that are trading today will give a false bias to your backtest For example, taking the constituents of the TSX as they are today would mean ignoring all 29 stocks that were delisted in the past 4 months Or 39 for the TSXV VENUES

The place in which stocks/futures/currencies are traded also affects your backtest Stock data can be quoted using their primary exchange or using a consolidated dataset Primary is more useful, prices can fluctuate more widely with the smaller orders that take place on other exchanges Currency markets are even more fragmented when compared to the stock market No requirement to trade at the best bid/ask across all venues Prices and sizes are not generally available without a delay SHORT SALE CONSTRAINTS

Shorting stock has a few drawbacks A broker first has to locate the shares you want to short You have to pay interest on the shares that you are shorting, and that can vary widely depending on short interest/difficulty of finding shares Small caps are more difficult to short ETFs are as hard to borrow as stocks The $1.5 billion short bet against cannabis stocks is costing $2.4 million a day, or 200 times more than an equivalently sized bet against a basket of stocks including Apple, Amazon, IBM

and Goldman Sachs, said Ihor Dusaniwsky, head of predictive analytics at S3 Partners. Shorting Cannabis Stocks Is Getting Costly https://www.nytimes.com /2018/09/17/business/dealbook /shorting-cannabis-stocks-costly.html WHEN NOT TO BACKTEST: EXAMPLE 1 The Situation A backtest shows an annualized return of 30% The Sharpe ratio is 0.3 The maximum drawdown duration is two years

Whats wrong with it? High return, low Sharpe is indicative of a fluke strategy Maximum drawdown is way too long for any sort of investor to have any confidence in the strategy WHEN NOT TO BACKTEST: EXAMPLE 2 The Situation A long only crude oil futures strategy returned 20% in 2007 Sharpe ratio of 1.5

Whats wrong with it? Simply holding the front month crude oil futures returned much more than 20% in 2007 This strategy is worse than just buying and holding Always choose an appropriate benchmark WHEN NOT TO BACKTEST: EXAMPLE 3 The Situation A simple buy-low-sell-high strategy picks the 10 lowest priced stocks at the

beginning of the year and holds them for a year. The backtest return in 2001 is 388% Whats wrong with it? Returns are simply way too high to not be skeptical If it seems too good to be true, chances are it is This example had survivorship bias, and when accounting for delisted stocks, the strategy returned -100% in 2001 WHEN NOT TO BACKTEST: EXAMPLE 4

The Situation A neural net trading model that has about 100 nodes generates a backtest Sharpe ratio of 6 Whats wrong with it? The words neural nets are red flags 100 nodes means that there are at least 100 parameters in the model Sharpe ratio of 6 helps indicate that the model is overfitted WHEN NOT TO BACKTEST: EXAMPLE 5 The Situation

A high-frequency E-mini S&P 500 futures trading strategy has a backtest annual average return of 200 percent and a Sharpe ratio of 6. Its average holding period is 50 seconds. Whats wrong with it? Backtesting a high-frequency strategy doesnt really make sense Placing/executing an order can affect the market, especially in HFT

Recently Viewed Presentations

  • The Giver

    The Giver

    The Giver. Day 2. Agenda: Pre-Reading Quiz & Discussion. Review Chapter 1. In class reading - Chapter 2. Homework. Pre - Reading Quiz. Take 10 minutes and answer the questions on the handout in front of you. Answer these questions...
  • Can a Humanoid Robot Spot a Liar? - Columbia University

    Can a Humanoid Robot Spot a Liar? - Columbia University

    The D1 dataset is used to demonstrate the possibility to spot future lies from already known participants, but not on unseen participants. The D2 dataset is instead used to try to obtain a general lie detector using a subset of...
  • Title

    Title

    Cycles of the Sun Length of Days & Nights Seasons Length of Days & Nights The Earth rotates on its axis A complete rotation takes a little over 24 hours (1 day) One side of the Earth is always facing...
  • International SpaceWire Conference 2007 17-19 September 2007 Benchmarking

    International SpaceWire Conference 2007 17-19 September 2007 Benchmarking

    The problem Multiple proposals for SpaceWire Vendors design new SpaceWire parts Benchmark Benchmark purposes Evaluate protocol proposals Compare network configurations Cost Performance Reliability Compare components Formalize requirements Improve the standard Benchmark Contents End units ...
  • NGAP Attracting, educating, training and retaining aviation professionals

    NGAP Attracting, educating, training and retaining aviation professionals

    NGAP Partner Organizations. Since 2009, ICAO has been working with important stakeholders, such as CAAs, industry, international organizations, ANSPs, training centres and universities to discuss how to address the impending shortage and how to inspire the next generation of aviation...
  • New Networks: The Power of Womens Funds For

    New Networks: The Power of Womens Funds For

    [email protected] Put more families on a path to economic security by: ... Establish a public-private Innovation and Collaboration Training Institute designed to build a systemic and collective approach to address issues and barriers to improve women's economic security.
  • Molecular Models and Potential Energy Surfaces

    Molecular Models and Potential Energy Surfaces

    CNDOL Hamiltonians and extended configuration interaction to approach nanoscopic systems Luis A. Montero Cabrera Ana L. Montero Alejo Universidad de La Habana
  • Rocks Section 1 Section 1: Rocks and the

    Rocks Section 1 Section 1: Rocks and the

    Three Major Types of Rock The material that makes up the solid parts of Earth is known as rock. Based on the processes that form and change the rocks of Earth's crust, geologists classify rocks into three major types by...