Author Topic: Pre-screened Database Tutorial  (Read 7434 times)


  • Administrator
  • Sr. Member
  • *****
  • Posts: 336
  • Karma: +13/-0
    • Pair Trading Lab
Pre-screened Database Tutorial
« on: February 10, 2013, 06:25:12 am »
Because users are constantly asking some tips about how to use the pre-screened database, we decided to post a short tutorial here.

The pre-screened database allows you to search a database of pre-rendered studies (I assume you already know what a pair study is meant to be here, if not, please check the FAQ and create some studies first, so you understand).

Essentially, this version of database has been created this way:
  • we took list of all US stocks using certain filters (minimum volume, market cap and average price)
  • we created pairs from them - all combinations per sector
  • we have stored them and indexed into the database

So right now, the database contains studies made for around 600,000 pairs. For each pair, 3 studies were created when possible - last 10 years, last 5 years and last 6 months. In addition, we filtered out studies of pairs based on stocks, which have incorrect price data/spikes/unadjusted splits in Google Finance database (not all of them, but most).
Studies covering the last 6 months period will be recalculated every month.

Now, we want to use the database to find good, stable, profitable pairs.

First, let's repeat, what we advise to check for pairs you are going to trade:
  • the pair should be profitable for most period settings (>95%) in backtests
  • backtest equities must be as linear as possible (in logarithmic scale) - very important rule - linearity of the equity curve means stability in profits over time
  • both stocks must be shortable at your brokerage without problems
  • never trade cheap/penny stocks (we would avoid anything cheaper than $5-$8 USD/stock)
  • avoid small market cap stocks (below 250M)
  • trading low-volume stocks is not recommended
  • both stock prices should be correlated enough
  • there should be additional fundamental relationship between these two companies, you should be able to give more reasons, why the pair should be profitable without seeing backtests

Now, how the database search will help you to follow these rules?
  • backtests - you can see for which settings is the pair profitable in the scatter plot - all the points (or most of) must lay above the 0% CAGR line, of course the higher CAGR and lower max drawdown, the better  ;)
  • linearity - you can observe the linearity yourself, or you can filter or sort on median of the linearity using period:Med. Linearity@rat or period:Med. Linearity@res
  • shortability - we cannot help you here, we advise after you finalize your pair selection, you will find out at your brokerage (for instance Interactive Brokers offers a special web-page where you can check detailed info about shortability as long you are their customer)
  • cheap stocks - we have already pre-filtered this (only stocks with price > $7 have been indexed)
  • small market cap stocks - we have already pre-filtered this (only stocks with market cap > 250M have been indexed)
  • low-volume stocks - we have included only stocks with average/last volume of 60k as minimum, of course the higher, the better
  • correlation - you can filter/sort on average correlation in the search
  • fundamental relationship - we cannot help you here, you must do your homework for this point (after you have your preliminary pair selection, you should inspect all those companies behind those stocks carefully)

Small example of search query, covering points above:
  • at this moment we are interested in pairs from Services sector
  • in this example, we are going to inspect last 5 years of history, using the Ratio model only
  • we want to find pairs with certain minimum average correlation - we set minimum to 0.8 (using the period=360 here)
  • we only want stable pairs profitable in history - we filter for Min CAGR>=0 and Median CAGR>=10 - this means, we search for pairs which performed break-even or profitable over ALL period settings and in addition which exhibit CAGR>=10% for at least HALF of all period settings
  • we are interested only in pairs with equity as linear as possible - so let's sort results by the equity linearity in descending order, so we see best pairs at the top
  • in addition, we might want only pairs of stocks having average volume at least 200,000 - for example

To be continued...


  • Administrator
  • Sr. Member
  • *****
  • Posts: 336
  • Karma: +13/-0
    • Pair Trading Lab
Re: Pre-screened Database Tutorial
« Reply #1 on: April 02, 2015, 06:47:08 am »
With the release of the new database system, this tutorial is now deprecated. We are going to prepare a new tutorial.