User Variables (V# and T# Variables)
A new facility has been added to Setup: Preferences to permit the user to provide column headings and numeric displays format preferences for each V#n variable available in the RTL Language. Choose Setup: Preferences: User Variables. Pick a particular V# variable, enter a column heading and adjust the display format for that V# variable. Click Apply to save the changes and leave the window open for further changes or click OK to save the changes and close the window. It is recommended but not required that you include the V# variable's name as part of the column title. For example if you use V#9 as an exponential moving average then you could assign it a column heading of "V#9-Exp MA" or "Exp MA V9". This assures that you easily see which V# variable is used for each column.
At one time there were a limited number of V# variables (user variables) for use in scans and trading signals, and some technical indicators. The number of user variables is now a user preference in Setup: Preferences: User Variables. The minimum number of user variables is six, V#1 through V#6. The maximum number is 512, V#1 through V#512. Each user variable can be given a name (used in quote page column titles) and a display format. It is recommended that you quit Investor/RT and start again when you increase the number of user variables. Memory usage for user variables is now dynamic. This means, for example, if you specify 100 user variables and you are tracking say 300 symbols, the memory space used to hold the V# data is allocated only as needed. User variables can be set by editing the variable's cell in a quote page or by using a SET statement in a scan. So if you run a scan to SET(V#100, ...) and the scan looks at 50 of your 300 symbols, memory for user variables is allocated only for those 50 symbols. Note that V#1 thru V#6 are always allocated for every symbol. These first six user variables are "persistent", that is, they retain their values after quitting and starting Investor/RT again. Various menus and lists in Investor/RT that display V# variable choices have all been enhanced to show the V# variables called for in Setup: Preferences: User Variables.
Setup: Preferences: User Variables has a "Legend" button which produces a text display listing user variables and their associated titles. The text window can be left open for on-screen reference. It may be printed by clicking the Print button on the main toolbar, or using the menu at the top of the Legend text window.
The Setup: Preferences: User Variables window now provides a new display format for user V# variables, called "Instrument" format. Instead of a fixed format for the user variable, any user variable can now be setup to use instead the display format of its associated instrument. When a V# variable has this format, the numeric values displayed in the quotepage column for that V# will be shown using the price format of the instrument for each row. Chart annotations that include %V#n in the annotation text will similarly display V# values using the instrument display format of the instrument associated with the annotation. During backtesting the Show and Note command output will be similarly affected for V# variables setup this way.
The Setup: Preferences: User Variables window has been enhanced to include both V# and T# variables. Use this window to assign a quotepage column title for each T# variable to indicate its purpose. T# variable are described below:
User Text Variables
The RTL language has been extended to include user text variables that hold up to 30 characters of textual information. Each ticker symbol tracked by Investor/RT has its own set of 32 textual values. The RTL token names for these variables are T#1, T#2, ... T#32, analogous to the nomenclature for numeric V# variables. Like V#'s, any T# variable may be displayed in a quotepage and may be included in a quotepage format. When a T# column is present in a quotepage, the cells in that column may be edited manually or updated with copy/paste operations, just as V# numeric values for any ticker symbol are adjusted in a quotepage.
The 32 T# values for each ticker are retained in the Investor/RT database. The Import feature of Investor/RT supports importing of textual content into any of the 32 T# variables. Simply setup a quotepage format that specifies the arrangement of the tab delimited data items in the incoming file and use the "Current Quotes/Other" import type to bring external ticker-specific textual data into one or more T# variables.
The RTL SET function can be used to clear or update the contents of any T# variable. For example, the following command in a scan:
SET(T#32, CLEAR)
will clear the text from T#32 for each instrument scanned. Setting can be conditional of course:
IF (BUYSIGNAL) THEN SET(T#11, "Buy Now!") ELSE SET(T#11, CLEAR);
Since T# variables can be used in chart annotations, you could, for example, have a chart annotation setup as "%TICKER at %CL %T#11". Thus the annotation will normally display just the ticker and current price but when T#11 is SET to "Buy Now", the annotation will update, showing that text in the chart window. Similarly, %T# tokens can be used in Signal Action message formats or in Chat Room or Email Alert message formats.
The SET command can not only be used to set a string constant into a T# variable ( e.g. SET(T#1, "Hello") ). The "string" can in fact be a message formatted with %RTL tokens, as in:
SET(V#1, MA) AND SET(T#20, "Buy %TICKER Below %V#1")
The moving average MA is first calculated, then the string "Buy %TICKER Below %V#1" is composed into something like "Buy AAPL Below 29.50" and this resultant string is set into the T#1 variable for display elsewhere in quotepages or annotations. You can even compose text from one or more T# variables:
SET(T#5, "%T#3 %T#4");
If, for a particular ticker symbol, T#3 is "hello" and T#4 is "world", this RTL formula will set T#5 to "hello world". If the resultant text is too long, it will be truncated to 30 characters by the SET operation.
The Setup: Preferences: User Variables window has been enhanced to include both V# and T# variables. Use this window to assign a quotepage column title for each T# variable to indicate its purpose.
The RTL Setup Window will show the current title for each T# (or V#) variable in the list of RTL tokens at the upper right of the window. If you right-click or double-click on a V# or T# token in this list, Investor/RT will open up the User Variable Preferences window, showing the setup for that particular V# or T# so you can conveniently enter a title and press OK. The RTL Setup window will then be updated to show the revised title.
T# variables can be scanned using character pattern matching, just as any other textual data token (such as USERDATA, or NAME). For example, the scan formula T#5 = "BUY*" will list all instruments whose T#5 value begins with the three letters BUY. The asterisk matches any string of zero or more characters while the ? will match any signal character. For example, T#5 = "*BUY*" will find instruments having BUY anywhere in their T#5 string. The pattern "?B??" will match a T# string having exactly 4 characters with the second character of the 4 being a B.
T# variables can be added directly to quotepage like any built-in column, or you can add a T# variable using a Custom Column if you wish to have more control over the color presentation of the text in quotepage cells. When a custom column references a built-in T# column, remember that the only "rule" type that you can use for text variables in the "Matches Text Pattern" rule. When you SET T# variables you can set a color code of some kind into the text that in turn is detected by the custom column and used to control the background/text color of the custom column cells. Here is a simple example. Consider a scan that runs periodically (the scan could run standalone, or the scan might be invoked by another custom column for that matter. Here is the scan formula:
IF (SET(V#1, MA) && CL > MA) THEN SET(T#1, "CL above %V#1")
ELSE SET(T#1, "CL below %V#1")
The custom column for T#1 could have two rules, the first one is a "Matches Pattern" rule with pattern text set to *above*, i.e. any string containing the word above, with an associated color combination of white text on green background. The second rule would match for pattern *below* and when true the text will display in white text on red background.