Saturday, April 16, 2011

How To Build A Thinkscript Scan

Basic Overview


When using the ThinkorSwim (ToS) platform for online trading, you'll want to find stocks that meet characteristics you've determined to be advantageous for buying or selling. Criteria could be volume, price ranges, or a custom calculation based off another value such as the MACD indicator, all of which are called Study Filters in ToS. These filters can either be Fundamental Filters or Scanner Custom Filters. Be aware that if you are learning with ToS and using the Paper Money tools, you can only add Fundamental Filters to your scans.

In order to set up a scan, open up your ToS platform and select that Scan tab and ensure the the Stock Hacker option is selected in the subsection. You can scan the entire listing of stocks or a subset of a market or industry, as well as your own watch list from researching stocks.

Selecting Scan Criteria


When selecting your criteria for a Thinkscript scan, you may find that too many results are found and more tuning is needed or additional elements are necessary to bring the resulting count down to a more reasonable number. Additionally, you can also specify a limit to be returned by the scanner, and sort the equities based on a specific column.

Basic Filter Setup

  1. Leave the default "Scan in" set to NYSE Stocks
  2. Click Add Fundamental Filter
  3. Change the criteria to Volume and set the minimum value at 1,000,000
  4. Click Add Fundamental Filter
  5. Change the criteria to EPS and set the minimum value at .50
  6. Set the Show value to 20 sorted by EPS in Ascending order
  7. Click the Scan button

You'll notice friendly histograms of the distribution of the criteria, which you can scrub back and forth to obtain the values you desire. After the scan completes you are presented with a listing of stocks that met your criteria arranged with a number of other columns of data for those equities. These columns can be customized, removed, and added to, as well. From here you can research this listing, fine tune your scan, and even create a watch list our of the results.

Adding Advanced Criteria


Here we are going to add a criteria to filter out the value of the MACD line often seen in stock charts like the one below.

Stockcharts.com AMGN chart with MACD

  1. Now click the Add Study Filter
  2. Change ADXCrossover to Custom
  3. In the Scanner Custom Filter window that pops up type:
    MACD() > 0
  4. Click OK and then click Add Study Filter
  5. Change ADXCrossover to Custom on the new entry
  6. In the Scanner Custom Filter window that pops up type:
    (MACD() > (MACD() - MACD().DIFF))
  7. Set the Show value to 20 sorted by EPS in Ascending order
  8. Click the Scan button

Wrapping Up

The additions in the second scan allowed us to compare equities based on a technical analysis aspect of recent price movements. In a matter of seconds all NYSE equities could be scanned which had strong earnings, respectable volume, and an improving to strong recent price movement. Of course if you wanted to buy penny stocks, you could simply change the filter to limit price to less than one to a few dollars.

Before closing your session, save your criteria so you can quickly reference it on a different day. Simply choose "Save Scan Query" just above the scan criteria and give it a memorable same, so that it can be loaded up at a later time and ran again. Hopefully, these basics will be helpful and be a stepping stone into more advance scanning criteria to quickly identify potential stock trading candidates in your ThinkorSwim platform.