Block Permanent Variables (BPV) are the same regardless of instrument.  At the start of a test, all BPV variables are initialized to a user specified value or to zero.  This initial value is retained until the value changed by scripting.  


BPV variables are accessible in all of the block script sections.  They also work a little faster than Local Variables, and are available anywhere in the range the Scope setting establishes.  Unlike Local Variables, BPV variables are initialize at creation and are reinitialized at the beginning of each parameter test-step.  


The initialization or the latest assigned value in a BPV variable is the same regardless of which instrument is being tested.  For example, the scripting assigns a day value to a BPV value early in the test process, that value will be the same for all the instruments being tested and will stay the same until scripting is used again to change the value.


Creating & Editing BPV Variables:

Click to Enlarge; Click to Reduce.

Block Basic Editor's BPV Access Menu

Double-Clicking on the Block Permanent Variables menu above will open the BPV Variable Editor Dialog shown below.

A Right-Click on the same menu item will display the BPV Menu Options shown next.


BPV's Menu Options:

Click to Enlarge; Click to Reduce.

Block Basic Editor's BPV Menu Options


BPV Variable Editor Dialog:

Click to Enlarge; Click to Reduce.

Block Permanent Variable (BPV) Editor


Variable Script Name & Display Name:


Script Name

This is the name seen in the BPV Variable List section  and in the scripted statements where it is used.  


Variable Name Rules:

Variable names cannot have a spaces or special characters anywhere in the name, however an underscore characters "_" are allowed.


Use variables names that make sense to you when you create them or change them.  When a variable name is changed, it will need to be change every place where it is used in the block's script section.  Variable names that are descriptive, will improve the understanding of why they are used.  Descriptive names also help to reduce the mystery of a statement's purpose.  For example, if you want the variable to hold the current day-of-month value (dayInMonth), that name reflects the variables purpose and reduce mistakes.  


Trading Blox Builder Common naming convention:

Use a Lower-Case letter as the first character in a name for Object Property variables.  

Uses an Upper-Case first letter for functions.

Display Name

This field is optional, but when it is used, the text should provide a description of the variable.  This field is displayed in the variable declaration section of the block, when it is Previewed or Printed using the option in the Editor's File menu.

Defined Externally in Another Block


This information explains: Defined Elsewhere this option.


Variable Types:



Any Integer numeric value (e.g. 1, -2,400, 5, etc.)

Floating Point

Any Decimal/Fractional numeric value (e.g. 2.5, 1.414, etc.)


Any instrument fractional number in the symbol's range of price values


Any keyboard character.  Value passed as letters must be bounded by quote marks (e.g. "Hello", "Goodbye", etc.)

Numeric Series

All data elements in a Numeric series are a Floating Point containers.  A series, also know as an array, are a list of numeric value locations that can hold the same, or a different a value in each of the series elements.  

Numeric Series/Arrays, can only contain a list of numbers. These can be tied to the test day using the "Auto-Index" feature described below.  They can also be a fixed manually sized series that can be expanded or reduce using scripting.  Fixed series are access by an index that is managed by scripted statements.

String Series

All data elements in a String series are a text character containers.  A String Series, also know as an array, are a list of String locations that can hold the same, or a different Strings in each of the element locations.  

Numeric Series/Arrays, can only contain a list of numbers. These can be tied to the test day using the "Auto-Index" feature described below.  They can also be a fixed manually sized series that can be expanded or reduce using scripting.

- a series or list of strings

A Series of Strings can be used for many purposes, but also as the x axis label of custom charts.


An Instrument type variable is a series variable that emulate the properties and methods associated with all Instrument Permanent variables (IPV) that contain the data and the abilities of an Instrument.  Where a BPV Instrument differs from an IPV variable series is its ability is in how it can be used to contain the value of any instrument that is accessible to the system during testing.  For example, an IPV instrument will only contain the values of the primary instrument, and the added IPV variables added in the IPV variable creation dialog.


IPV instruments can only be directly accessed in script sections that provide automatic context.  Whereas, BPV instruments can be used to emulate any available symbol information by using the LoadSymbol function.  When the LoadSymbol function is looped, it can access any of the instrument information by using the LoadSymbol function to move the information from a symbol's instrument series into the BPV instrument series.  


To get a better understanding of how this works, look at the sample code example available in the LoadSymbol topic.


In the Trading Blox Builder Roundtable Blox Market Place, there are more examples that show different purposes for loading IPV instrument information into a BPV instrument.  e.g. "Indicator or other Computations."


Variable Names and Types cannot be changed using scripts.  To make a change to either, that change must be done using the BPV Variable Editor.  

There is more information In the About Data Variables topic and some variable use examples.


Variable Options:


Default Value

The value entered into this field will be the initialized value this variable will have at the beginning of a test.  Initialized values and be changed by script statements or functions.


The selected Scope determines where this variable can be accessed and changed.


BPV variables are allowed to use the following scope settings:

Block -- This scope allows the variable to accessible only within the blox where it is declared.

System -- Allows this variable to accessible from within any of the blocks in the System where this block is listed.

Test -- Allows this variable to be accessible in any of the block in any of the systems within the testing Suite.

Simulation -- This scope is the same as Test scope, except the value will not be reset when the Suite is performing a multi-step parameter test.  This means the last value of this variable will be the value that appears at the beginning of the next parameter testing step.

Auto-Index Series

Click to Enlarge; Click to Reduce.

BPV Series Indexing Options

A BPV Series with Auto Index checked, will track the test.currentDay index.  When Auto-Index is NOT Enabled, the series will be a static series that is managed and a accessed with scripting.

Plotting Controls

This option will not appear unless the BPV variable is seting to a System-Scope, or to a Test-Scope.  When that is the setting, this area on the dialog will appear:

Click to Enlarge; Click to Reduce.

Appears when a BPV is System-Scope, or Test-Scope.


The color of a graphed plot is assigned using the Plotted Color Selector.

The graph name where the plotted information is to appear is determined by the name entered into the Graph Area field.

The type of plotted display is based upon the selection appearing in the Graph Style selector.

When more than one series is being plotted in a custom graph, and one of those series has enabled "Log Scale" option, then all series plotting in the same Graph Area will plot as log scale.

When you plot more than one BPV variable in a custom graph, be sure the ranges of the all the series is within a reasonable range for all the series being plotted in that same graph area so the display is readable and consistent.

When a blox is used to create a custom graph, and that blox is inserted in multiple systems, there will be multiple plotted graphs displaying information from each of the systems.  This is also true when you use multiple plotting statements in in your test, then multiple Summary Custom Charts will be created for each one.


Plotting BPV Series variables on the Summary Custom Chart

Be sure to enable the Custom Graph check-box in the Preferences' Single Test Reporting section.  See the Trading Blox Builder User's Guide manual Reporting Information's Graphical Reporting topic for more information.

Click to Enlarge; Click to Reduce.

BPV Series Preference Custom Graph Ploting Option


Graph Plotting:

To plot a BPV-Series variable, the defined Scope setting must select either the System, or the Test scope option.  This setting will enable the BPV-Variable Editor to display the Plotting Control area.

Click to Enlarge; Click to Reduce.

BPV Series Indexing Options


BPV variables defined to create a Custom Graph image at the end of test Will appear something like this next graph image:

Click to Enlarge; Click to Reduce.

BPV-Variable Custom Graph - Margin/Total Equity %

The above graph is an example that display the amount of Margin as a percentage of the Test's Total-Equity.  This graph is created and displayed in the Custom Graph area of the Performance Summary report.  


Graph's created for a Performance Summary Report are saved in the Results section.  In the Results section there will be a folder that matches the Performance Summary file date and time information.  Contained in that folder are all the graphs displayed in the Performance Summary report.


Custom Graph are static images used for reporting.  This needed approach for reported prevents the image from display any of the plot location values that a cursor might select.  However, the data used to create a Custom Graph is easily be exported to the Print Output.csv file, or to a custom file that can be used to see the values as a text, or a spreadsheet table or plotted chart.  


Script Statement Example:

  '  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: 4/15/2018 8:42:18 AM

Topic ID#: 310


Created with Help & Manual 7 and styled with Premium Pack Version 2.80 © by EC Software