Parameter Reference

Top  Previous  Next

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 Builder 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.

 

parameterWindow

 

The Parameter Type is an Integer in the case above. The supported types are:

 

 

 

Integer

 

whole number values e.g. 1, 400, 5, -10

 

Floating Point

 

fractional numeric values e.g. 1.25, 2.5, 187.41415

 

Percent

 

numeric percentage e.g. 1.5%, 10%. Enter these as a decimal (.50 for 50%).

Boolean

 

values that are either TRUE or FALSE

 

Selector

 

values that are selected from a list of values. You can assign values using the "Selector Entries".  These values will appear in a drop-down menu, and can be stepped through.  An example might be "Trade Long", "Trade Short", and "Trade All".  The Basic Constant is the code you would use to reference this selected value.  This is filled in automatically when you create a selector

 

Default Value

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 80.

 

Scope

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.

 

User Interface

Here is how this parameter looks to the user:

 

parameterGUI

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.