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.

 

Example

' If this instrument is in the top rankings...
IF instrument.longRank <= rankThreshold THEN
 
  instrument.AllowLongTrades
ENDIF


Edit Time: 9/25/2017 09:09:58 AM


Topic ID#: 343

 

Created with Help & Manual 7 and styled with Premium Pack Version 2.80 © by EC Software