This script section executes before instrument data is loaded. This means it can change which instruments will get loaded during the Before Test Script section.
This script section can enable, disable one or more symbols in the portfolio. Symbols that are disabled, will not be loaded in their inactive state. When an instrument is not loaded, the data it would have consume will remain available. The time to load the data, would be used. In simple terms, reducing the active symbols in a portfolio reduces the memory required and the time it would take to load the symbols and calculate the systems indicators.
The Set Parameters script executes:
•After the Before Simulation script and ahead of the Before Test script.
•Before the system's indicators are computed..
•This script section support the script.InstrumentLoop function that will automatically loop through all the symbols in the portfolio.
•Enabling and Disabling indicators and custom IPV and BPV series disabled will reduce some test time.
•Setting the Type Value of an indicator, before the indicator is computed. i.e. Changing from a SMA of the Close to an SMA of the Open can also be handled in this section.
How to change an instrument's ability to Load:
The process uses this function when called from this script section.
script.InstrumentLoop( "anyCustomInstrumentScriptName" )
When called from another script section, the example in the instrument.DisableTrading topic can be used.
Note:
•Regular Indicators that use Price or Volume as a data source are not recomputed for each stepped test run unless an indicator dependent parameter changes value.
• Calculated Indicators and Regular Indicators that use another indicator as the source data, are still recomputed for each test.
•Multi threaded testing computes indicators for each thread separately, which uses memory and time as initial overhead.
When the Set Parameters script section isn't displayed in a blox, the following sequence of steps will add it after the script that is right-clicked to enable an additional script section to be loaded.
The Set Parameters script section will always run after the Before Simulation script is finished executing. It will also run before the Before Test script section is run.
These indicators and series can be set as enabled or disabled by default in the Trading Blox Builder Basic editor.
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"
This script detail is placed Set Parameters script section so the custom script "iOnOff_Instrument" can be executed when the Set Parameter script section executes.
' ==============================================================
In this example, the Symbols to disable are hard coded into the conditional: If ( sSymbol = "CD" ) OR ( sSymbol = "DJ" ) THEN
That can be changed by defining a list of symbols the custom script can use to learn what needs to be disabled.
' ============================================================== ' script.InstrumentLoop( "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: 6/20/2020 1:46:31 PM |
Topic ID#: 700 |