Parameters are a very powerful feature of Trading Blox. Parameters allow you to create systems that present their own user interface to allow the user to easily change system settings.
For example, you can create a parameter to be used for the number of days in a moving average, and then change that value when you run your system for historical testing or trading purposes without altering your Blox or Systems. Trading Blox automatically creates a user interface for your parameters which give the user the option of setting a fixed value or stepping through a series of values for every parameter you define. Parameters can also be referenced directly as if they were a variable in any scripts in the block where they are defined.
To create a Parameter, select "Parameters" on the left and click the "New" button, or double-click the Parameter heading:
Adding a New Parameter Setting:
Most of the indicators require Parameter values, but not all of them. Adding a parameter setting reference uses a dialog that is available here:
New Parameter Setting Steps:
oEnter the parameter setting property name in the "Name for Code" field.
oEnter the parameter setting description to display for this parameter.
oSelect the Parameter data type.
oEnter a default value.
oSelect the parameter value scope.
oDecide if this parameter needs to delay calculations because of look back referencing.
oIf parameter requires stepping change priority, enter a step number.
The Parameter Type is an Integer in the case above. The supported types are:
Data Type Name:
Data Type Description:
Whole number values e.g. 1, 400, 5, -10
Fractional numeric values e.g. 1.25, 2.5, 187.41415
Numeric percentage e.g. 1.5%, 10%. Enter these as a decimal (.50 for 50%).
Values that are either TRUE or FALSE
String value such as "hello" or "20081001"
Parameter selector provides a drop-down list of meaningful names for users.
Selector parameters allow user-defined name list.
Names of each option are not allowed to be the same name as an existing Trading Blox Constant, variable, or a user created variable name.
Names of the days in a week, Monday, Tuesday, etc., are Trading Blox defined Constant names. Weekday or any of the other Constant names are not allowed as an option name.
User-defined variables and indicator names are not allowed as an option name.
First option name created is assigned the value of zero. Each sequential name will be assigned the next available integer value until all options are assigned a value.
List of option name sequence is adjustable during creation and by using the Move Up or Move Down controls below the option listing area. Any change in the sequence of names will cause the values of each name to change.
In operation, the user selects one of the options from a drop-down list of option names. Selector Parameter Options can be stepped when the Step All option enabled when it is enabled.
The default value is the number initially assigned to the parameter when first presented in the Parameter Editor for a system. After that initial setting Trading Blox Builder will remember the current value, so the Default Value is only used the first time a system is used for a Test Suite..The Default Value for the parameter above is 0.
Set the scope based on what blocks and scripts need access to this parameter. If you set to Block scope (default) only the scripts in the block will have access. If you set to System scope, then all scripts in all block in the system will have access. If you set to Test scope, then all scripts in the test will have access.
Used for Lookback
Check this box if the parameter is going to be used to reference past values of an indicator or past values of an instrument.
For example, if you are using the following type of code in your script, the parameter "closeLookback" should be a lookback parameter:
IF instrument.close[ closeLookback ] > instrument.close THEN
If you are only using this parameter as input to an indicator, then you do not need to check the lookback box.
Priming will be increased by this lookback value plus 1. So for a lookback value of 5, the first day scripts would run is day 6. Overall priming is the maximum bars required for indicators plus one, plus the maximum lookback parameter plus one.
This sets the priority of this parameter for stepping purposes. When stepping multiple parameters, the highest value priority will be stepped first, and the lowest will be the outer step. The global parameters have a step priority of zero, so to have your custom parameters step after the globals, use a negative step value. This can be left at zero for most situations.
Here is how this parameter looks to the user:
We can access this parameter in scripts by using "closeAverageDays". Parameter can also be used for inputs to Indicators. In fact, this is probably the most common use for parameters.
NOTE: Parameters are READ ONLY. They can be accessed by scripts, but not changed by them.
Edit Time: 3/4/2018 1:18:08 PM
Topic ID#: 330