Our next step will be to add user menu parameters and scripted rules to the Entry Orders script section. Scripts put in the Entry Orders script are called for every bar record in every instrument selected in the system's portfolio. Scripts placed in the Entry Order Filled script are only executed when an Entry Order has been filled.
Exit Order scripts are only executed when an instrument has an active position. Exit Order Filled script are only called when an Exit Order is filled. Understanding how script are only executed when necessary will help you understand how important it is to place rules into the script section for the purpose that each script section is used, and when it is executed.
User menu parameters are editing fields on the main screen where a selected system shows it parameters. These parameters expose text fields where you will be able to change the values entered to see how the block module changes alter the results of the system. In our simple Moving Average Convergence Divergence system we will need two parameters where we can set the calculation lengths for the MACD's short and long moving averages that will comprise the a MACD indicator.
To create our first parameter right click on the Parameter list item to bring up the Items menu, or use the Items menu once the Parameters list item is selected. In this menu, select the New menu item to create a new Parameter.
This same menu access process can be used for all items such as Block Permanent Variables (BPV), Instrument Permanent Variables (IPV), Parameters, and Indicators. This brings up a New Parameter dialog Window where new parameters can be added, or existing parameters can be edited.
Parameter Dialog Details:
•Name for Code: Our first parameter will use the name: shortMovingAverageBars for the parameters code name. This name is what we will use when we want to refer to this parameter in a script. Notice how the name is fairly descriptive. By using compound words that are descriptive, the scripted code becomes self documenting making it easier to understand what its intended purpose. In this name we are using the word "Bars" to refer to an instrument's price record. For daily data a bar is one daily data record. For weekly records, bar refers to one week record. Parameter code names cannot contain any characters other than alphabetical letters, numbers and an underscore " _ " character, and the name must begin with an alphabetical character.
•Name for Humans: This is the name users of the block will see. Name can have spaces and special characters, as it is for display purposes only. We normally indicate the unit of measure so it is clear to the user the basis for the parameter. In this case we indicate (Bars) so the user will understand the count will be individual data records. For example, a value of 10-bars, for daily data will tell the block to use 10 days or 10 daily records. A weekly data file will use 10-weekly records, and an intraday data file will use 10-intraday records.
•Parameter Type: We need to let the system know what type of input we are expecting. In this case the input (Bars) will be an integer value. For other parameters we might want to input floating point, percent, or other types.
•Default Value: Value enter will be the default value. It is also the value displayed when the Blox module is first added to a system. Once added to the system and left in place, the user can change the value and the system's suite file will remember the last value the trader entered. For our block we will use a short moving average length or 20 bars.
•Scope: Defines whether this value will be available to just this block, to the system, or to the whole testing range of information. For our purposes, we will use the default value of Block.
•Used for Lookback: Check this box only when you use this parameter to reference historical values of indicators, or price series records. If this parameter is used as a parameter in an Indicator you do not need to check this box.
•Stepping Enabled: Value stepping is controlled by this option. When it is enabled, the value in the parameter can be stepped in an optimization test. In the image pair below the Stepping option is shown how it changes the user's main screen parameter option. When the Stepping option is enabled in the parameter editing dialog, a "Step" option is available with the parameter item. When it is not enabled, there isn't a "Step" option available and a stepped optimization will not be possible until the parameter's setting is changed.
•Stepping Priority: This is used to control the order in which the parameter are stepped.
With the above understanding, create the longMovingAverageBars period calculation length parameter. Enter the value of 40 as its default setting. Use the same option selection we used for the first parameter. Once you are finished, press OK.
Use the same process as described for the longMovingAverageBars parameter to create the ShortMovingAverageBars calculation period length parameter. Enter a value of 20 as this parameters period length.
We now see our two parameters in our Parameter List and in the second image how they will appear when they are connected to a system file and that system file is connected to a Suite on the main screen.
When there is a"Step" option associated with a parameter it indicates that parameter can be used in a series of value changes for each step. For example in this next image the Short Moving Average value will be stepped through 6-values starting from a value of 5 to an ending value of 30:
When this system is run through a simulation test it will execute the system through its entire data range listed in the Start and End date period entered. When all the step values have been tested Trading Blox will generate a Performance report showing the results of each stepped value. This tutorial won't step the parameters, but more will be available in other sections of this Help file.
This completes this topic with the information we need to move on to the step in this tutorial.
Edit Time: 9/25/2017 09:09:58 AM
Topic ID#: 123