This script allows you to indicate whether an instrument should be included for testing or not using the Trade Control Functions functions of the instrument trading object. Note that if there is no scripting code in the Filter Portfolio script, then the ranking will not take place. Some code in the Filter Portfolio script is required in order for the ranking to take place, and the rank to be determined and defined.
You can check the longRank or shortRank in relation to a fixed rankThreshold type parameter (ie x number of instrument).
You can also check the rank vs. the total number of instruments in the portfolio to trade only the top x% of the instruments. This value is the system.totalInstruments property.
You can also check the rank vs. the total number of trading instruments. This value is the system.tradingInstruments property.
Once this script is finished, it sets the system.canTradeInstruments to the total number of trading instruments that can trade today based on this script logic.
' If this instrument is in the top rankings...
IF instrument.longRank <= rankThreshold THEN
Edit Time: 5/10/2017 8:36:38 AM
Topic ID#: 343