Navigation: Realtest Script Language > Syntax Element Details >







Stock/Contract Information


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


The single parameter to this function can be either a list number, e.g. InList(2) or a list name, e.g. InList("my_list")


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 the example at the end of the IncludeList page for information on how to refer to an include list by name rather than by number.

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




Copyright © 2020-2024 Systematic Solutions, LLC