Built-in variables
These names resolve to a series without being called. Prices and volume come from the bars currently loaded on the chart.
| Name | Meaning |
|---|---|
CLOSE, C | Close price. |
OPEN, O | Open price. |
HIGH, H | High price. |
LOW, L | Low price. |
VOL, V | Volume. |
AMOUNT, AMO | Turnover. |
ISUP / ISDOWN / ISEQUAL | 1 when the bar closes up / down / flat. |
TR | True range of the bar. |
DRAWNULL, NULL | The invalid value. Assign it to hide a point on a line. |
CURRBARSCOUNT | Number of bars from this bar to the last bar. |
TOTALBARSCOUNT | Total number of bars loaded. |
BARPOS | 1-based index of the bar from the start of the data. |
ISLASTBAR | 1 on the most recent bar only. |
BARSTATUS | 1 = first bar, 2 = last bar, 0 = anywhere in between. |
PERIOD | Timeframe code: 0 day, 1 week, 2 month, 3 year, 9 quarter, 4 1-min, 5 5-min, 6 15-min, 7 30-min, 8 60-min, 11 tick-level. |
DATE | Bar date as YYYYMMDD minus 19000000. |
DATETIME | Combined date and time value. |
TIME | Bar time as HHMMSS. |
YEAR / MONTH / DAY | Calendar parts of the bar. |
HOUR / MINUTE | Clock parts of the bar. |
WEEK, WEEKDAY | Day of week, 0 = Sunday. |
CODE | Symbol code as a string. |
STKNAME | Symbol name as a string. |
FROMOPEN | Minutes elapsed since the session open. |
TOTALFZNUM | Total trading minutes in the session. |
MACHINEDATE | The local machine date, in the same encoding as DATE. |
MACHINETIME | The local machine clock time as HHMMSS. |
MACHINEWEEK | The local machine day of week, 0 = Sunday. |
TIME2 | Bar time in the alternate encoding used by intraday data. |
WEEKOFYEAR | Week number within the year. |
DAYSTOTODAY | Calendar days from the bar to today. |
AUTOFILTER | Signal de-duplication flag used by the scanner. |
The variables below are accepted by the compiler but are served by a China A-share style feed. On the current market data source they resolve to nothing, so a script that uses one draws an empty pane rather than reporting an error.
| Name | Meaning — legacy feed only |
|---|---|
VOLR | Volume ratio against the recent average. |
VOLINSTK, OPI | Open interest (futures). |
SETTLE, QHJSJ | Settlement price (futures). |
ZSTJJ | Intraday average price line; valid on intraday timeframes. |
CAPITAL | Free-float share capital, in lots. |
TOTALCAPITAL | Total share capital, in lots. |
EXCHANGE, HSL | Turnover rate. |
SETCODE | Market type code. |
TQFLAG | Current adjustment mode: 0 none, 1 back-adjusted, 2 forward-adjusted. |
INDEXO / INDEXH / INDEXL / INDEXC / INDEXV / INDEXA | Open, high, low, close, volume and turnover of the market index. |
INDEXADV / INDEXDEC | Advancing and declining counts in the market index. |
HY_INDEXO … HY_INDEXDEC | The same eight fields for the symbol's sector index. |
ADVANCE / DECLINE | Advancing and declining counts for the symbol's own index. |
HYBLOCK / DYBLOCK / GNBLOCK | Sector, region and concept block names. |
FGBLOCK / ZSBLOCK / ZHBLOCK / ZDBLOCK | Style, index, combination and custom block names. |
GNBLOCKNUM / FGBLOCKNUM / ZSBLOCKNUM / ZHBLOCKNUM / ZDBLOCKNUM | How many blocks of each kind the symbol belongs to. |
HYZSCODE | Index code of the symbol's sector. |
HYSYL / HYSJL | Sector price/earnings and price/book ratio. |
DYNA_NOW | Last price from the live quote; falls back to the previous close before the open. |
DYNA_ZAF / DYNA_ZAS | Live change ratio and rate of change; multiply by 100 for a percentage. |
DYNA_LB | Live volume ratio. |
BUYVOL / SELLVOL | Outside and inside volume from the live quote. |
ACTINVOL / ACTOUTVOL | Aggressive buy and sell volume. |
LARGEINTRDVOL / LARGEOUTTRDVOL | Large-order buy and sell volume. |
TRADENUM / TRADEINNUM / TRADEOUTNUM | Total, buy-side and sell-side trade counts. |
LARGETRDINNUM / LARGETRDOUTNUM | Large-order buy and sell trade counts. |
CUR_BUYORDER / CUR_SELLORDER | Total resting bid and ask size. |
BIDORDERVOL / BIDCANCELVOL | Cumulative bid volume placed and cancelled. |
OFFERORDERVOL / OFFERCANCELVOL | Cumulative ask volume placed and cancelled. |
AVGBIDPX / AVGOFFERPX | Latest average bid and ask price. |
DOPEN / DHIGH / DLOW / DCLOSE / DVOL | Open, high, low, close and volume of a caller-defined custom timeframe. |