RealTest User Guide
RealTest User Guide

 

 

Navigation: Running Scans >

Multi-Filter Scan

 

 

 

 

By default, RealTest scans will contain, at most, one row per symbol per date, or one row per position per date for TestScan in TestScanPositions: True mode.

It is also possible to output multiple rows for the same symbol or position on the same date, with different contents.

Before RealTest provided a built-in order generation feature, scans were used to create CSV order lists e.g. for IB Basket Trader input. This was the original use case for multi-filter scans.

To potentially output multiple rows per symbol per date, simply use multiple filter formulas. The maximum number of rows per symbol per date will be the number of different filter formulas provided. Each row is only output for any filter if its formula returns a non-zero value ("TRUE") for that symbol on that date.

To add multiple filters to a scan definition, start the name of each one with the word "filter" and then add one or more other characters to make their names unique. RealTest interprets any Scan or TestScan formula name that begins with "filter" as a filter definition rather than a column definition.

When specifying the formulas for the columns that you want to output, you will need to know which filter formula caused the current row to be included. This information is provided by the FilterNum syntax element. FilterNum simply returns the filter number currently being evaluated. The number returned refers to the sequence in which the filters were listed in the script. Any numbers that happen to be included in the filter names are ignored.

 

Here’s a simplified example of a long/short MR strategy pair using the same set of setups, just different limit prices, configured so each “order” would have its own scan row (some execution engines such as IB basket trader require this):

 

 

This shows how the Scan includes two filters with the same condition. This simply produces two rows per symbol per day for each symbol that meets the specified "setup" condition. The Action and LimitPrice formulas use FilterNum to produce different output for each row for the same symbol.

 

 

 

Copyright © 2020-2026 Systematic Solutions, LLC