Navigation: Examples and Tutorials >

Tutorial 3 - Simple Scan

 

 

 

To start the third tutorial, close any child windows that remain open, then open the script called import_spx.rts in the Examples folder (see the previous tutorial for instructions on how to do that).

This example script contains only an Import section. Click on  to run the script and import data for each current (as of June 2020) stock in the S&P 500 index, along with the SPY ETF, going back to the start of 2014. (Feel free to edit the SP500.txt file if the components have changed, or even better, use Norgate Data instead of Yahoo to automatically gain access to both current and historical index members.)

You will see that the Yahoo import runs fairly quickly. This is because RealTest creates multiple threads for the import, each with a separate HTTP connection to the Yahoo servers.

When the import has finished, close this script window and open the example script called sample_scan.rts.

This script introduces several new elements: ScanSettings, Data, and Scan.

ScanSettings is analogous to TestSettings in the first tutorial example. It just tells RealTest what data file to use and what date range to scan.

The Data section is probably the most important feature of RealTest. Please take a moment to read this description of the Data Section before continuing.

Did that make sense? Good. Now please go and read about the Scan Section as well.

Now at last we are ready to simply run this scan, which will be anticlimactic. Just press the  button and the scan output will appear:

In this example, we are scanning only the most recent date in the data for stocks that are currently down at least 25% from their 126-day (half-year) highest close.

The output is alphabetical by symbol, but as with the Results window in the previous tutorial, you can click on any column header to sort by that column.

Click on the Drop column to see the stocks that are down the most in this period:

(your results will be different from mine unless you explicitly change the scan EndDate to 6/19/20)

Now double-click on the first row to open a chart for that stock with that date as its right-most bar:

Once the chart window is open, you can simply keep pressing the down arrow key on your keyboard to cycle through all the charts from the scan output (or press up to go back to the previous one). Notice that the scan window automatically highlights the line corresponding to the current chart symbol. To see both at once, just move and resize the two windows as desired (this is why I like the classic Windows multiple document interface).

To see other things that can be done with scan output, open the Scan menu either form the menu bar (when the scan is the active window) or by right-clicking within the scan window:

The entire contents of the scan can be either copied to the clipboard (from which it will paste into Excel with columns preserved) or saved as a CSV file.

There is also a SaveScanAs option in the ScanSettings section, which, if specified, causes the scan output to be automatically saved every time the scan is run. This can be useful for something like producing a daily trading candidate list.

Thus ends the third tutorial.

 

 

 

Copyright © 2020-2021 Systematic Solutions, LLC