Instrument object provides access to all the built-in properties provided to all instruments, and to all the new property names added by the user.

 

Bar Indexing

Properties listed with a '[ ]' following them are series properties and may be indexed using a number to access a previous data record value.

 

Properties with [ ] will support access to earlier values:

currentInstrumentDate = instrument.date (date of current bar )

currentInstrumentTime = instrument.time (time of current bar if using intraday data)

priorInstrumentDate = instrument.date[1] (date of prior bar )

( special case: instrument.date[-1] is allowed to see the date for the next record. Not available on the last record of data. )

 

Lack of [] defaults to 0. So these are the same:

todaysClose = instrument.close

todaysClose = instrument.close[0]

 

Using [1] will return the prior bar to the current. This could be the prior day for daily data, or prior minute for minute data.
priorClose = instrument.close[1]

 

When a property does not support '[ ]' like the instrument examples above, those properties are not series and contain values of the current bar location, or their values are static for an instrument.  For example, instrument.bigPointValue is a static value for each instrument, and instrument.bar is reference value that provides the current record number of that instrument.

 

Data Access Properties:

Property:

Description:

activeStatus

optional value for stocks, A for active and I for inactive

averageVolume

Current 5 day EMA of the unAdjustedVolume.  Used internally by Trading Blox for volume filters such as max volume per trade and minimum volume.  

 

This property is computed dynamically during the simulation run and can be used in scripting as needed. This property cannot be used in Calculated Indicators because all values for all calculated indicators are computed before the simulation starts running, and this property has not been computed yet.

 

Test computed indicators do not support look-back references.  However, their calculated result from each instrument bar can be stored in an IPV series that will support look-back referencing if that process is coded into the blox.

bar

Bar number for the current date. Bar 1 is the first bar of data loaded. The start of the test is likely not Bar 1.

barSize

 

bigPointValue

Usually 1.00 for Stocks, unless the Convert Profit by Stock Splits global is on. In that case the big point value is the unadjusted close divided by the adjusted close for any given day ( see .conversionRate )

 

For Futures it is the value set in the Futures Dictionary in the Big Point column.  When it is applied it is adjusted by the currency conversion rate, if there is one.  Does not change for futures.

 

For Forex, the current value in dollars for the pair its value can change each day.

brokerBigPointValue

Value is entered into the Futures Dictionary in the Futures Dictionary column Broker BPV. This column is used by the brokerage when their value for their symbol is different than what is used by the data service being used (See bigPointValue for how it is applied.)  

brokerSymbol

Broker symbol as defined in the dictionary

close[ ]

Close price of a specific instrument data record

closeAsk[ ]


country


conversionRate

The conversion rate of foreign denominated futures and stocks. This property respects the "reverse conversion" check-box option in the Forex Dictionary.  

 

instrument.conversionRate is not a series.  It is a property that is computed on the fly during the test based on the instrument date and the value it calculates from the instrument's date matching Forex currency data.

 

If the Forex conversion file is not current to the latest date the instrument, this property will use the last available record in the Forex file to calculate the conversion rate in all instances after the Forex file's data ends.  In most cases the last date won’t give an accurate local price so be sure to keep the Forex files current.

 

Note:

instrument.conversionRate replaces instrument.forexRate and will be removed in a later version of Trading Blox.

currency

Currency in which the future is denominated. Set in the Futures or Stock Dictionary.

currencyBorrowRate

Borrow rate of the currency.

currencyDate

Current date of the currency converter, if present.

currencyLendRate

Lending rate of the currency.

currencyTime

Current time of the currency converter, if present.

currentBar

Bar number minus the startBar plus one.

currentWeek

instrument's weekIndex minus the startWeek plus one.

custom1

Blank column cell for each symbol.

custom2

Blank column cell for each symbol.

customSortValue

Property contains the value assigned by the instrument.SetCustomSortValue().

dataLoadedBars

Total number of bars of data loaded and cached.

dataVendorID

Optional value for stocks, the data vendor id

date[ ]

Date value for the specified bar. In YYYYMMDD format.

dayClose[ dayIndex ]

Close of the current day as of the current time

dayHigh[ dayIndex ]

High of the current day as of the current time.

dayIndex

Current day index for use with the day series which is derived from intraday data

dayLow[ dayIndex ]

Low of the current day as of the current time

dayOpen[ dayIndex ]

Open of the current day

dayVolume[ dayIndex ]

Volume of the current day as of the current time

defaultAverageTrueRange

Current internal computation of the 39 day average true range. Used internally for slippage calculations.  

 

This property is computed dynamically during the simulation run and can be used in scripting as needed. This property cannot be used in Calculated Indicators because all values for all calculated indicators are computed before the simulation starts running, and this property has not been computed yet.

 

Test computed indicators do not support look-back references.  However, their calculated result from each instrument bar can be stored in an IPV series that will support look-back referencing if that process is coded into the blox.

deliveryMonth

Delivery month of the contract represented by the data -- format: YYYYMM  (futures only)

deliveryMonthLetter

Delivery month letter (Z for December, etc)

description

Description from the appropriate dictionary for this symbol

displayDigits

Number of digits to the right of the decimal, as set in the dictionary.

dividend

Dividend for the current bar

endBar

Bar number for the last day of testing for this instrument. Not system specific.

endDate

End date of testing for this instrument. Not system specific. Can be different than the lastDataLoadedDate if the end testing date changes to an earlier date after the data is loaded and cached.

exchange

Instrument's exchange

exchangeBroker


exchangeName


exchangeRegion


extraData1[ ] ... extraData8[ ]

Value of any optional extra data appended to the data file for the specified bar. There are up to 8 extra data fields you can use with this format.

fileName

Filename of the instrument

firstDataLoadedDate

First date of the data loaded and cached for this instrument. Not system specific.

folder

Folder location of the file

forexBaseBorrowRate

Borrow interest rate of the Base side of the Forex pair

forexBaseCode

Provides transparency as to what the interest rate date is used for the base and quote currencies.

forexBaseDate

Provides transparency as to what the interest rate date is used for the base and quote currencies.

forexBaseLendRate

Lending interest rate of the Base side of the Forex pair

forexPipSize

Pip size of the Forex market as set in the Forex dictionary with 7-decimal maximum size

forexPipSpread

Pip spread as set in the Forex dictionary

forexQuoteBorrowRate

Borrow interest rate of the Quote side of the Forex pair

forexQuoteCode

Provides transparency as to what the interest rate date is used for the base and quote currencies.

forexQuoteDate

Provides transparency as to what the interest rate date is used for the base and quote currencies.

forexQuoteLendRate

Lend interest rate of the Quote side of the Forex pair

high[ ]

High for the specified bar

highAsk[ ]


industry


inPortfolio

Returns TRUE if the instrument is in the system's portfolio. returns FALSE if the instrument is a supporting Forex file or loaded using LoadSymbol and not in the portfolio.

intradayData

Returns TRUE if the instrument is using intraday data

isForex

Returns TRUE if the instrument is a Forex  -  See Data Class Properties

isFuture

Returns TRUE if the instrument is a Future  -  See Data Class Properties

isPrimed

Returns TRUE if the instrument is primed.  Each instrument is considered primed when the instrument bar count is greater than the longest look-back parameter value that has been enabled in the parameter declaration dialog.

ISIN

 

isStock

Returns  TRUE if the instrument is a Stock  -  See Data Class Properties

julianDate[ ]

Number of days since 1900 for the current bar

lastBarOfDay

Returns  TRUE if the bar is the last bar in the day

lastDataLoadedDate

Last date of the data loaded and cached for this instrument. Not system specific.

lastDayOfMonth

Returns  TRUE if the bar is the last bar in the month

lastDayOfWeek

Returns  TRUE if the bar is the last day in the week

lastDayOfYear

Returns  TRUE if the bar is the last bar in the year

lastTradingInstrument

Returns  TRUE if the instrument is the last trading instrument for the trading day.

low[ ]

Low for the specified bar

lowAsk[ ]


margin

Margin requirement for a futures instrument as set in the Futures Dictionary.

 

Not used for stocks or Forex.

 

See instrument.usedMargin for each symbol's margin amount in stock or futures systems.

minimumTick

Amount of the minimum tick in points. For futures this is set in the Futures Dictionary. For stocks this is .01 divided by the stock split adjustment, which is calculated as the unadjusted close divided by the adjusted close. In this way, the actual minimum tick for the time period can be determined.

minimumVolume

Minimum volume setting from global parameters. Uses the stock minimum value for stocks, and the futures minimum volume for futures. Forex Returns  minimum volume of zero.

monthClose[ monthIndex ]

Close of the current calendar month, as of the current day

monthHigh[ monthIndex ]

High of the current calendar month, as of the current day

monthIndex

Current month index for use with the month series

monthLow[ monthIndex ]

Low of the current calendar month, as of the current day

monthOpen[ monthIndex ]

Open of the current calendar month

monthVolume[ monthIndex ]

Available Monthly volume known for the specified bar.

 

Note:

Future contract volume reported on the last bar of the month might not be the exchanges settled volume for that month.  Historically, Future contract settled volume values are reported one trade-day after the price record date.

nativeBPV

Native currency big point value, as set in the dictionary

negativeAdjustment

Use with back-adjusted data that goes below zero (eg CL).  All prices are raised so that no price will be negative.  This is the amount  by which the prices are raised.  Normally you don't need this since the debugger prices, trade prices, and order generation prices are all converted back to normal prices. But if you need the actual price for calculations in the script, or to print the value, then you would subtract this amount.

open[ ]

Open for the specified bar

openAsk[ ]

 

openInterest[ ]

Open interest for the specified bar (when available).

orderSortValue

Default Instrument Order Sort Value at the beginning of a test:

Instrument Type:

Default Priority Index Order:

Futures

Futures in a portfolio are sorted and assigned a Priority Index value in ascending order.

 

First sort is by the value in the Futures Dictionary's 'Order Sort Value' field.  Symbol records for Futures will be sorted by the value in this field.

 

When more than one symbol in the Dictionary has the same  'Order Sort Value,' the records with the same 'Order Sort Value' will be grouped.  

 

Each will have the symbol records within the same-value group sorted in ascending alphabetical order.

 

If all the symbol records in a group have the same value in the 'Order Sort Value' field, the symbols selected for the portfolio will appear in ascending alphabetical order.

 

 

Click to Enlarge; Click to Reduce.

Default Futures Order Sort Value Priority Index Example.

Forex

All portfolio symbols are sorted in ascending alphabetical order.

Stocks

All portfolio symbol are sorted in ascending alphabetical order.

priorityIndex

At the start of testing the default symbol order in which the instruments are listed as explained by the description in the '.orderSortValue' property above.

 

Trading Blox Builder provides instrument Ranking Functions and Ranking Properties.  It also has System functions Rank Instruments and SortInstrumentList function that process the instrument ranking assignment changes and the sort the portfolio list of symbols based up the SortInstrumentList option used for the sorting.  Some of the better rules for ranking instruments are those created by the user so they meet their system's needs.

 

As part of the changes created by the ranking and sorting of instruments in the portfolio, the priorityIndex assignments are updated so the sorted list of symbols has an ascending list of index values.

 

Instruments are processed for each test date record using the '.priorityIndex' property index.  An instrument with an '.priorityIndex' value of one is processed first, a index value of two is processed next.  Each remaining instrument in a portfolio is then process using the next ascending index number,

 

Ranking and sorting that changes the priority index assignments can be performed for each test date.

 

Each instrument in a blox that contains a script sections that are automatically assigned instrument context, those script section will process the portfolio instruments in the same way.  

referenceID

This property is a special object pointer that is used by custom DLL extension functions to access instrument object information.

roundLot

Returns  the round lot of the instrument, as set in the dictionary

savedWFProfit

The Walk Forward process saves open positions from one OOS test to the next. For Forex, the profit is saved as well to help compute the overall profit of the combined OOS tests. This value is available in the After Test script for debugging purposes.

sector

 

startBar

Bar number of the first day of testing for this instrument taking into consideration the priming required for this instrument for this system.

startDate

Start date of testing for this instrument and system taking into consideration priming. Is usually different than the firstDataLoadedDate.

startWeek

The weekIndex of the startBar

stockSplitRatio

The ratio of the unadjusted close to the adjusted close. When Convert Profit by Stock Splits global is on, then the profit is multiplied using this ratio on trade entry date vs. trade exit date, to account for the increase in shares due to the splits during the course of the trade.

symbol

Instrument's trading symbol, e.g. S, IBM, CL

symbolWithType

Returns the symbol in "F:GC" or "S:IBM" format.  Use when accessing a symbol outside of the system where the symbol portfolio is located.  For example in a LoadSymbol operation in a GSS blox.

systemClosedEquity

Current system closed equity for the instrument

systemOpenEquity

Current system open equity for the instrument

systemTotalEquity

Current total system profit/loss for the instrument

testClosedEquity

Current test closed equity for the instrument

testOpenEquity

Current total test open equity for the instrument

testTotalEquity

Current total test profit/loss for the instrument

time[ ]

Time value for the specified bar. 0 if daily data. In HHMM format.

tradeDayOpen

Open for tomorrow. Useful in the Entry script to know the open for the trade day.

tradesOnTradeBar   (New)

 

tradesOnTradeDate (Obsolete)

Returns  TRUE if the instrument trades on the current trading date/time. Works for intra day as well as daily systems to confirm if there is a bar of data for the current test date/time. Important to use when excluding holidays from a computation.

tradingMonths

Trading months list defined in the Futures Dictionary. Used only for accounting for contract rolls estimation, when the data does not have the delivery month.

unadjustedClose

Actual close price unadjusted for contract merging (futures), splits, or dividends (stocks)

unAdjustedVolume

Volume for stocks, unadjusted by stock splits. Typically the the raw OHLC and V in the data series are all adjusted for stock splits.

usedMargin

Total margin used for the current open position.

 

Value returned is purchase equity for stocks and total margin for futures.

 

See instrument.margin for futures margin amount.

volume[ ]

Available volume known for the specified bar.

 

Note:

Future contract volume reported on the last bar of the day, week or month might not be the exchanges settled volume for that day, week or month.  Historically Future contract settled volume is reported one trade-day after the reported price record date.  

weekClose[ weekIndex ]

Close of the current calendar week, as of the current day

weekHigh[ weekIndex ]

High of the current calendar week, as of the current day

weekIndex

Current weekIndex used for the week series.

weekLow[ weekIndex ]

Low of the current calendar week, as of the current day

weekOpen[ weekIndex ]

Open of the current calendar week

weekVolume[ weekIndex ]

Available Weekly volume known for the specified bar.

 

Note:

Future contract volume reported on the last bar of the week might not be the exchanges settled volume for that week.  Historically Future contract settled volume is reported one trade-day after the reported price record date.  

 

Links:

Data Functions

See Also:

 

 


Edit Time: 9/25/2017 09:09:54 AM


Topic ID#: 388

 

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