Data Access Properties

Top  Previous  Next

Bar Indexing

Properties listed with a '[ ]' following them may be indexed using a number which determines which day's data to access. There are also built in constants for 'today' and 'yesterday' which can be used. For example:

 

yesterdaysDate = instrument.date[ 1 ]

 

or

 

yesterdaysDate = instrument.date[ yesterday ]

 

will access yesterday's date.

 

If no index is used (i.e. like instrument.date above) then the value will return the current bar. This value will be set to yesterday's bar for scripts which are run before the trading day and to today's bar for scripts run after the current date has been set.

 

Data Access Properties:

 

 

 

symbol

 

the instrument's trading symbol, e.g. S, IBM, CL

brokerSymbol

 

the broker symbol as defined in the dictionary

description

 

the description from the appropriate dictionary for this symbol

exchange


the instrument's exchange

isStock


returns TRUE if the instrument is a stock

isFuture


returns TRUE if the instrument is a future

isForex


returns TRUE if the instrument is a forex

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.

bar


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

currentBar

 

the bar number minus the startBar plus one.

startBar

 

the bar number of the first day of testing for this instrument

endBar

 

the bar number for the last day of testing for this instrument

tradingBars

 

the total number of bars for the current test settings

folder

 

the folder location of the file

fileName

 

the filename of the instrument

startDate

 

the start date of testing for this instrument.

endDate

 

the end date of testing for this instrument. The last bar of instrument data.

isPrimed

 

returns TRUE if the instrument is primed

tradesOnTradeDate

 

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.

roundLot

 

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

intradayData

 

returns TRUE if the instrument is using intraday data

date[ ]

 

the date value for the specified bar. In YYYYMMDD format.

time[ ]

 

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

open[ ]

 

the open for the specified bar

high[ ]

 

the high for the specified bar

low[ ]

 

the low for the specified bar

close[ ]

 

the close for the specified bar

volume[ ]

 

the volume for the specified bar

averageVolume

 

the current 5 day EMA of the unAdjustedVolume. Used internally for volume filters such as max volume per trade and minimum volume.

unAdjustedVolume

 

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

defaultAverageTrueRange

 

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

openInterest[ ]

 

the open interest for the specified bar (if available)

 

 


weekIndex

 

the current weekIndex used for the week series.

startWeek

 

the weekIndex of the startBar

currentWeek

 

the weekIndex minus the startWeek plus one.

weekOpen[ weekIndex ]

 

the open of the current calendar week

weekHigh[ weekIndex ]

 

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

weekLow[ weekIndex ]

 

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

weekClose[ weekIndex ]

 

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

monthIndex

 

the current month index for use with the month series

monthOpen[ monthIndex ]

 

the open of the current calendar month

monthHigh[ monthIndex ]

 

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

monthLow[ monthIndex ]

 

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

monthClose[ monthIndex ]

 

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

dayIndex

 

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

dayOpen[ dayIndex ]

 

the open of the current day

dayHigh[ dayIndex ]

 

the high of the current day as of the current time.

dayLow[ dayIndex ]

 

the low of the current day as of the current time

dayClose[ dayIndex ]

 

the close of the current day as of the current time

dayVolume[ dayIndex ]

 

the volume of the current day as of the current time

lastDayOfWeek

 

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

lastBarOfDay

 

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

lastDayOfMonth

 

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

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.

 

julianDate[ ]

 

the number of days since 1900 for the current bar

tradeDayOpen

 

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

activeStatus


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

dataVendorID


optional value for stocks, the data vendor id

 



deliveryMonth

 

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

deliveryMonthLetter

 

the delivery month letter (Z for December, etc)

unadjustedClose

 

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

 

 


extraData1[ ] ... extraData8[ ]

 

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

orderSortValue

 

the order sort value as entered in the Futures Dictionary

priorityIndex

 

the numerical order of the instruments used in a system.  For futures, the order is based on the order ranking in the futures dictionary.  For stocks and Forex, the order is alphabetical. Each system will have its own ranking of instruments. All scripts that loop over instruments will do so in this order.

 

 


minimumTick

 

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

displayDigits

 

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

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. For Futures, as set in the Futures Dictionary and adjusted by the currency conversion if there is one. Does not change for futures. For Forex, the current value in dollars for the pair. For Forex, this number can change each day.

nativeBPV

 

the native currency big point value, as set in the dictionary

margin

 

the margin requirement for a futures instrument as set in the Futures Dictionary. Not used for stocks or forex.

usedMargin

 

the total margin used for the current open position. This is purchase equity for stocks and total margin for futures.

negativeAdjustment

 

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

currency

 

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

currencyDate

 

The current date of the currency converter, if present.

currencyTime

 

The current time of the currency converter, if present.

currencyLendRate

 

The lending rate of the currency.

currencyBorrowRate

 

The borrow rate of the currency.

forexBaseLendRate

 

the lending interest rate of the Base side of the forex pair

forexBaseBorrowRate

 

the borrow interest rate of the Base side of the forex pair

forexQuoteLendRate

 

the lend interest rate of the Quote side of the forex pair

forexQuoteBorrowRate

 

the borrow interest rate of the Quote side of the forex pair

conversionRate

 

The conversion rate of foreign denominated futures and stocks. This respects the "reverse conversion" checkbox in the forex dictionary.

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.

minimumVolume


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

systemTotalEquity


the current total system profit/loss for the instrument

systemOpenEquity


the current system open equity for the instrument

systemClosedEquity


the current system closed equity for the instrument

testTotalEquity


the current total test profit/loss for the instrument

testOpenEquity


the current total test open equity for the instrument

testClosedEquity


the current test closed equity for the instrument

forexPipSize


the pip size of the forex market as set in the forex dictionary

forexPipSpread


the pip spread as set in the forex dictionary

tradingMonths


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