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. |
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 |
When used with daily data, the instrument.barSize property will return D1 |
||||||||||||
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[ ] |
Close of the current day as of the current time |
||||||||||||
dayHigh[ ] |
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[ ] |
Low of the current day as of the current time |
||||||||||||
dayOpen[ ] |
Open of the current day |
||||||||||||
dayVolume[ ] |
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 |
Exchange where this instrument signal is traded. |
||||||||||||
exchangeBroker |
|||||||||||||
exchangeName |
Instrument's Exchange Name listed in the Futures Dictionary. |
||||||||||||
exchangeRegion |
|||||||||||||
extraData1[ ] to 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 added column 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 |
|||||||||||||
Returns TRUE if the instrument is in the system's portfolio. When the instrument is not in the portfolio, or the instrument.DisableTrading function has been applied to a symbol in the selected portfolio, this property will returns FALSE. |
|||||||||||||
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 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. |
|||||||||||||
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[ ] |
Close of the current calendar month, as of the current day |
||||||||||||
monthHigh[ ] |
High of the current calendar month, as of the current day |
||||||||||||
monthIndex |
Current month index for use with the month series |
||||||||||||
monthLow[ ] |
Low of the current calendar month, as of the current day |
||||||||||||
monthOpen[ ] |
Open of the current calendar month |
||||||||||||
monthVolume[ ] |
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's currency valuation. |
||||||||||||
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:
|
||||||||||||
At the start of testing, the default symbol order in which the instruments are listed is 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 instrument.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, are automatically assigned instrument context. Those script section will process the portfolio instruments in the same way. Accessing an instrument in a script section where instrument context isn't automatically assigned, will need the LoadSymbol function to access an instrument. |
|||||||||||||
referenceID |
This property is a special object pointer that is used by custom DLL extension functions to access instrument object information. |
||||||||||||
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. |
||||||||||||
Open for tomorrow. Useful in the Entry script to know the open for the trade day. |
|||||||||||||
(New) |
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. |
||||||||||||
tradesOnTradeDate (Obsolete) |
This Instrument property has been obsoleted, but it is still active in some scripts. When this property is used it will provide the same information as instrument.tradesOnTradeBar, but at some point a Trading Blox Builder upgrade version might remove it from the active instrument properties. |
||||||||||||
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[ ] |
Close of the current calendar week, as of the current day |
||||||||||||
weekHigh[ ] |
High of the current calendar week, as of the current day |
||||||||||||
weekIndex |
Current weekIndex used for the week series. |
||||||||||||
weekLow[ ] |
Low of the current calendar week, as of the current day |
||||||||||||
weekOpen[ ] |
Open of the current calendar week |
||||||||||||
weekVolume[ ] |
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: |
---|
See Also: |
Edit Time: 11/12/2020 2:07:42 PM |
Topic ID#: 388 |