Trading Objects Reference

Trading Objects represent real-world objects used in trading, the instrument object represents a tradeable market, the broker represents the broker who takes your orders, etc.


Blox Basic scripts use the Trading Objects to access information and to affect the trading simulation.


The Trading Objects used in Trading Blox Builder are:

Object Names:



represents the current Trading Block and is generally only used for debugging purposes


Broker methods are used to enter orders with their stops when protective exit prices are used, and exiting positions.


Broker Entry order call the Unit Sizing script, which is followed by the Can Add Unit script.  Both entry and exit orders are processed by the Can Fill Order script.


used to create custom charts

Email Manager

used to send emails from scripting


used to read and write files


Represents a given market, or a tradeable instrument to access pricing, position, and other information that is useful for influencing system orders and positions.


contains information about the order used in the Can Fill Order script


used to access custom user scripts


represents the system itself and is used to access system-level information such as the total equity


represents the test and is used to obtain test-level information like the start and end dates


Trading Objects are accessed through the use of each object's reserved keyword.  A complete list of Blox Basic Keywords is available in the JellyFish folder that is placed in the Blox folder where Trading Blox is installed:

Trading Blox Keywords File Name and Location

Bar Indexing:

Instruments with a price record date are known as price bars.  Price bars are records where an instrument’s four price records create a vertical bar on a chart display.  This referencing is also true for intraday data where the same date is used for a series of price records that have a different transaction time stamp for their price bar.  It is also used for instrument records where less than four price records show the open, high, low and close or last price of a price record.


When looking back through a series of price records, or through a series of property value records, the most current record is referenced with a series offset value of zero, i.e.[0], is the current instrument record for any symbol.  This offset method is also true to reference the property value of a property like Total Equity.  For example test.totalEquity[0] is the current equity value made available at the end of the current test day.  Test information that can be access previous values created during test simulation are contained in an array.  An array is a series of values and property and instrument information that allows access to previous information is known as a series because of values that were created earlier in a test.


Users can create a series for storing earlier information in either a BPV or an IPV data type.  Series in both data types can be auto-index or they can be manual.  Auto-index series automatically get size with the required number of array elements.  Manual series must be sized and indexed by the programmer creating a manual series.  Manual series have the require functions to handle sizing, referencing, and sorting in two different ways and directions.  Auto-indexed BPV series are aligned to test.currentDay values.  Auto-indexed IPV values are aligned to each instrument’s price record.


All Trading Blox default properties that are kept in a series are automatically created and kept current by Trading Blox.  User created series must be first created and then their values must be maintained serviced by code the programmer creates to keep each element in the series useful.


To reference other price bars or equity values that are preserved in a series use this reference to help you understand what is being referenced:



1-bar ago

2-bars ago

3-bars ago

4-bars ago, etc…







Previously Trading Blox provided constants today and yesterday to use.  These are no longer supported.


Properties listed with a '[ ]' must now be indexed using an offset number:

  '  Test Total Equity from 4-bars ago is assigned to the variable equity.
  equity = Test.TotalEquity[ 5 ]

  '  Yesterday's Instrument's Date is assigned to the variable yesterday.

  '  A value of 1 references date record just before this date.
  YesterdaysDate = Instrument.Date[ 1 ]



Syntax Colors:

Trading Blox Basic Editor will color various script element types with the colors set in the Syntax Colors section of the Blox Basic Preference section.


Professional coding editors by default use syntax coloring.  Coloring various code elements in various ways helps the person writing the code to understand when the spelling is correct, and in the case of Trading Blox Basic Editor, they can also understand if the object element is in context in the script section where the object's element is being referenced.  Coloring variation of different groups helps to make reading easier and faster when type types use different colors.


Trading Blox Basic Editor will also vary the color of object elements that have designated scripts where the that object is not normally in context.  This means that the color of a object type will be the color designated in the Preference's Syntax Colors, but it will be a different color when it is in a script section where it is not normally in context in the script section.

Edit Time: 3/5/2019 2:06:28 PM

Topic ID#: 634

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