Text Variables (T# Variables)

The RTL language enables user text variables that can 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 quote page.

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.

Related Articles: