Block Permanent Variables are the same regardless of instrument, and retain their value (unlike variables declared with the VARIABLES statement). For instance, dayNumber (shown below) will be the same for Gold or Silver unless changed in a script.
To create a Block Permanent Variable, select "Block Permanent Variables" on the left and click the "New" button.
Name for Code
The name of variable as you would use it in a Script. Common convention is that you start variable names with a lower case, and use upper case for the first letter of each subsequent word or part of the variable name. No spaces or special characters are allowed in variable names.
Name for Humans
A more friendly description of the variable. In the case of Block Permanent this name is not displayed anywhere, but is useful to remember what the variables purpose is.
The kind of value the variable will be. This cannot be changed in a script.
For a description of the different types, see the VARIABLES section. In addition to the two types listed there Block Permanent Variables can also be of type Series and Instrument:
•Series - A series is a list of numbers, sometimes referred to as an array. These can be tied to the test day using the "Auto-Index" feature described below.
•A Series of Strings can be used for many purposes, but also as the x axis label of custom charts.
•Instrument - An instrument variable can be used to refer to specific market indexes or to iterate over the instruments in a portfolio.
The Default Value is the value that will be assigned to the variable when it is first used. So in this case at the start of running the program, the variable dayNumber will be set to 50.
Upon creation, you can now use this variable in any of the Scripts of the Block using the variable name "dayNumber".
The Scope determines where you can use this variable.
•Block -- You can only use this variable in the scripts that are in the block.
•System -- You can use this variable in any block in the System.
•Test -- You can use this variable in any block in the Test.
•Simulation -- Same as Test scoped except the value is not reset for every test (parameter run).
Plotting BPV Test Scope Series variables on the Summary Custom Chart
If you define a BPV as a Series variable that is System or Test scope you have the option to plot this series on a Summary Custom Chart. Select Plots on Trade Graph, the color, style, and select a Graph Area. The Graph Area is used for the title of the chart. If you have more than one plotting variable with the same Graph Area, they will be plotted together so make sure the range is common and consistent. If you have multiple different Graph Areas in your test, then multiple Summary Custom Charts will be created for each one.
Be sure to check the Custom Graph checkbox in Preferences for the chart to show up. See the Trading Blox User manual for details.
If any plotting BPV series are defined as "Log Scale" then all series plotting in the same Graph Area will plot as log scale.
A BPV Series with Auto Index checked, will track the test.currentDay index.
To plot the Margin to Equity ratio, create the BPV below and put the following in the After Trading Day script:
plotMarginEquity = test.totalMargin / test.totalEquity * 100
Edit Time: 9/25/2017 09:09:58 AM
Topic ID#: 310