At the beginning of a test, Trading Blox Builder automatically loads the portfolio's Instument Data Properties (IPV).  

 

Each IPV data object is specific to one of the portfolio symbols loaded during the initialization of a test.  During testing, instruments are processed one symbol at a time in the script sections that automatically provide instrument context (See Accessing Instruments).  

 

This data is placed the Instrument Permanent Variables (IPV) that is made available in each of the scripts sections that provide automatic context for instruments that test instruments during a test.  

 

Data loaded is the various properties at the start of a test can be different for each instrument.  Data in a dictionary needed to support market information  during a test can be the same.  For instance, the point value for Corn and Soybeans can be the same.  However, it won't be the same when an instrument is testing Gold.

 


Creating & Editing IPV Variables:

Click to Enlarge; Click to Reduce.

IPV Editor Menu

Double-Clicking on the Instrument Permanent Variable (IPV) menu above will open the IPV Variable Editor Dialog shown below.

A Right-Click on the same menu item, and then selecting the New or other options will display IPV Editor.

 

IPV's Menu Options:

Click to Enlarge; Click to Reduce.

Block Basic Editor's BPV Menu Options


IPV Variable Editor Dialog:

Click to Enlarge; Click to Reduce.

Instrument Permanent Variable (IPV) Editor

 

Variable Script Name & Display Name:

Descriptions:

Script Name

This is the display name of the IPV 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.

 

The Name for Humans is a more friendly description of the variable. In the case of Instrument Permanent this name is not displayed anywhere unless the variable is a series, but is useful to remember what the variables purpose is. For series variables, the Name for Humans is used as the label.

Defined Externally in Another Block

 

This information explains: Defined Elsewhere this option.

 

Defined Externally in Another Block -- check this option if this variable has been declared as System Scope in another block in the system. This option lets the Syntax Checker know about this variable.

 

Variable Types:

Descriptions:

Integer

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

Price

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

String

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

Numeric Series

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.  Each element in a Numeric series are a Floating Point variables.  

 

Numeric Series/Arrays, can only contain a list of numbers.  These can be aligned to an instrument's date 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 determined by scripted statements.

String Series

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

 

String Series/Arrays, can contain a list of numbers if they assigned by another String variable, or by bounding the a numeric value with quote marks.  (e.g. "54210", "100.25", etc.)

 

A String series can be aligned to the instrument's date value using the "Auto-Index" feature described below.  They can also be a fixed manually sized series that can be expanded or reduce using scripting.  Manually size series are accessed by an index value determined by scripted statements.

 

A Series of Strings can be used for many purposes such as labels or words that might be needed more than once.  They can also be used as the x axis label in a custom charts.

 

The Variable Type is the kind of value the variable will be, and cannot be changed in a script. For a description of the different types, see the VARIABLES section.

Note:

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:

Descriptions:

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.

Scope

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.

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.

 

The Scope determines where you can use this variable. Instrument Permanent Variables cannot be Test scope.

Auto-Index Series

Click to Enlarge; Click to Reduce.

BPV Series Indexing Options

An IPV Series with Auto Index checked, will track the instrument.date property of the current symbol be accessed.  When Auto-Index is NOT Enabled, the series will be a static series that is managed and a accessed with scripting.

 

For both Block Permanent and Instrument Permanent, if you do not select Auto Index, you must specify a size for the array. This example, curentStopPrice, is an Auto Index series that plots in the Price Chart graph area in Red as Small Dots.

 


Adding IPV variables can extend the capabilities a system might needed during execution.  

Click to Enlarge; Click to Reduce

IPV Variable Control Dialog

 

Plotting Controls

This option will not appear unless the IPV variable Type is a Numeric Series:

Click to Enlarge; Click to Reduce.

IPV Series Plotting Options

Plotting Control Option:

Description:

Plots

To display the series data as plot on a sysmbol's chart, enable this option.  When this option is enabled, it will display a plot on the chart section determined by the Graph Area option below.  

Display Value

When data is plotted on a chart, it will show the plot information on the screen.  The value os the data displayed can be seen by viewing chart section where various types of data are displayed on the right side of the chart area.  For details about what is displayed, review the Trading Blox Builder Help User's Guide Help, Main Screen's topic Trade Chart.  

Plot Color

A wide range of colors for a plot display can be found in the Trading Blox Builder Help User's Guide Help, Editing Item Colors topic.

Graph Area

The Price Chart area is the default area where most of the plotted indicators are displayed.  However, when the values being plotted are below or above the displayed price range of the chart, the plot be on the chart, but it won't be visible.  To make it visible, create a text-name that is entered into the Graph Area field that will represent the plotted information so that  Trading Blox Builder can create a sub-chart area in the chart display that will display the plot information that needs it own plotted range.

Graph Style

Click to Enlarge; Click to Reduce.

Click on the IPV Chart Plotting Styles Options image on the left to see the ten different styles of plots available for an IPV numeric series.

Offset Plot Ahead One Bar

This option will move the last plot information one test-record to the right.  This option allows stops that are calculated on the day before the next trade record to be display in the location where the next trade record prices will be display when the next trade record is created.

String Series Display Value

Click to Enlarge; Click to Reduce.

IPV Sring Series Display Option

 

An IPV of type Series String can be used to display a different string value for each bar on the trade chart. It will not plot of course.

 


Access:

You can access Instrument Permanent Variables through scripting two ways.

 

1.Using the variable directly. This will return the variable for the current instrument:
myInstrumentVariable = 5
IF myInstrumentVariable = 5 THEN PRINT "It is 5"
 
If a Series object you can access and set the index values:
mySeriesVariable[1] = 5
IF mySeriesVariable[1] = 5 THEN PRINT "Yesterday was 5"

 

2.Or you can access instrument variables using the instrument or another instrument variable object as follows:
instrument.myInstrumentVariable = 5
sp500Index.myInstrumentVariable = 5
sp500Index.mySeriesVariable[1] = 5
 
IF instrument.myInstrumentVariable = 5 THEN PRINT "S&P has 5"
IF sp500Index.mySeriesVariable[1] = 5 THEN PRINT "S&P has 5"

 

Accessing a variable using the instrument '.' syntax is equivalent to using the variable directly. The '.' syntax is the only way to access the value of instrument variables which are not part of the current instrument.

 


Edit Time: 4/15/2018 2:21:28 PM


Topic ID#: 320

 

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