This function should be used in the Set Parameters script section because it executes after the Before Simulation and before the Before Test sections.
This function is similar to the way that the Script.Execute function will execute "UserCreatedCustomName." Both the Script.Execute() and this function script.InstrumentLoop() will call a custom script named section to perform tasks.
See the Creating Custom Scripts topic for more information.
When this function is used, it will call a "UserCreatedCustomName" that will be able to automatically loop-over all of the instruments in the system's portfolio.
The list for changing an instrument, is a list created by the user. The script will use those some or all of those symbol when it is deciding to change the state of the instrument.inPortfolio status. When a symbol match is found, the instrument.DisableTrading function will change the state to False. Which symbols in a portfolio are removed from trading is dependent upon how the conditional conditional statements are created for matching a symbol in the portfolio with a symbol-name on the list.
Syntax: |
---|
' Function calls the Custom-Script created for |
Parameter: |
Description: |
---|---|
anyCustomScriptName |
Custom script's name created to perform a task. |
Example: |
---|
' Custom script adds two numbers together |
Returns: |
---|
The return will be the execution of the scripts in the custom script name used as the script parameter. |
Example: |
---|
This is an example of how a custom script can be created to disable symbols in a portfolio from being used by the system. The name of the custom script created is "iOnOff_Instrument." ' ============================================================== |
Returns: |
---|
System's Portfolio has four symbols: AD, DJ, ED, CD Prior to this custom script running, all of the instruments were active and would load if this script had not been run.
Calling Script Name: Set Parameters Output shows the Date when the instrument's inPortfolio property was changed.
instrument.inPortfolio at start, shows all the symbols will show TRUE. When the instrument.DisableTrading is executed, it will change to FALSE. Date: Symbol inPortfolio-State 20140402 AD 1
20140402 DJ 1 20140402 DJ 0
20140402 ED 1
20140402 CD 1 20140402 CD 0
|
Links: |
---|
See Also: |
|
Edit Time: 9/21/2020 3:03:37 PM |
Topic ID#: 95 |