Navigation: Realtest Script Language > Syntax Element Details >

InList

 

 

 

 

Category

Stock/Contract Information

Description

Checks whether this symbol was part of a specific IncludeList when it was imported

Notes

If the current data file was imported using multiple IncludeList statements, InList can be used to filter symbols based on their include list membership.

This is especially useful when a strategy uses one set of symbols for trading and a different set of symbols for calculating an indicator.

Here is a contrived example:

A breadth indicator is constructed using NDX components by counting how many of them are above their 20-day averages.

The strategy trades only DJIA components and only when the NDX breadth indicator is above 80.

This example could also have used Constituency: $NDX, $DJI and replaced the InList(1) with InNDX and InList(2) with InDJI. Using historical index constituency (requires Norgate Platinum subscription) is recommended for backtests in order to avoid survivorship bias. The InList technique is shown here is only advisable for daily scans or very recent backtests.

For examples of other ways to use InList, see combined.rts and vigilant_asset_allocation.rts in the Examples folder.

See also ListNum, which returns the number of the first list that included a symbol.

 

 

 

Copyright © 2020-2022 Systematic Solutions, LLC