The RTL formula (syntax) checking process has been improved in several ways to facilitate entry of RTL scan, signal, and custom indicator formulas. The improvements are designed to facilitate entry of technical indicator tokens in cases where multiple tokens are needed for the same technical indicator. In addition, the improvements enable the user to extend the technical indicator tokens available for use in RTL formulas through the use of pre-defined technical indicator "presets". RTL technical indicator tokens can reference other scans, signals, and custom indicators directly by name.
Using Token Suffixes
Consider a scan to identify instruments whose 20 period simple moving average has just crossed above the 100 period simple moving average. To formulate this scan prior to these improvement you would first add the MA token twice to the list on the right using the ==> button. When you do this, Investor/RT will prompt for the setup for each MA. You must then assure that each MA related token has a unique name so you can refer to the different moving averages in the scan formula. You might assign the token name MA_twenty to the first MA token and MA_hundred to the second token. Then the scan formula can then be entered MA_twenty.1 < MA_hundred.1 AND MA_twenty > MA_hundred;
Notice the way the tokens are named in this example. First there is a "real" token MA followed by an underscore and then some arbitrary characters that make the token unique. This convention for naming tokens is appealing because it makes clear that the token is in fact an MA and the underscore provides a visual separator between the real token and the suffix for improved readability, just as the period is used to visually separate the entire token from the numeric qualifier .1. The improvements made to the RTL formula setup are based on this technical indicator naming convention. When technical indicator tokens are entered directly into a formula without pre-defining them, Investor/RT will now do much of the setup work for you. The new convention can be summarized as follows:
When entering a technical indicator token, you have three options
- the actual token in upper case, e.g. MA, RAWK, CI
- the actual token in lower or mixed case, e.g. ma, rawk, ci
- the actual token in mixed case followed by a "suffix". The suffix always begins with an underscore followed by a series of letters, e.g. ma_st, ma_longterm, RAWK_one, RAWK_two
More succinctly, any technical indicator token can be entered in mixed case optionally followed by a suffix that begins with an underscore character. When you enter a formula using this convention Investor/RT will do much or all of the token setup work. To see the effect, open the RTL Setup Window (Setup: Scan or Setup: Signal). The setup window will appear with the formula entry area blank and no tokens listed on the right. Enter the following formula into the entry area ma_twenty.1 < ma_hundred.1 and ma_twenty > ma_hundred
Press the "Check" button. Investor/RT will respond by adding MA_twenty and MA_hundred automatically to the list on the right. Both of these token names will be setup as MA tokens. Investor/RT will prompt you with the MA preferences window so you can setup each token with the appropriate moving average period. The MA setup dialog will show text such as "Preferences for RTL Token MA_twenty" to indicate the name of the token to which the setup applies.
Using Indicator Presets as RTL Tokens
Suppose that you use 20 and 100 period moving averages often in scans, signals, and custom indicators. If so, you may have setup MA presets for 20 and 100 period presets. Investor/RT uses the suffix naming convention described above to identify references to technical indicator presets. This enables any preset to be referenced directly in the RTL language. The rule for referencing presets is as follows:
If an RTL technical indicator token has a suffix (e.g. _twenty) and there is a preset defined for that indicator that has the same suffix, then the preset indicator preferences will be automatically associated with the RTL token without user prompting.
Suppose for example that you create presets for the moving average indicator with names like "mySimpleMA_twenty" and "mySimpleMA_hundred". To create presets, go to any setup window for an indicator, set the preferences as you wish to record them, click on the Preset button and choose "New". You will be prompted for a name for each preset. When naming a preset that you may wish to use in RTL, put the suffix you want to use at the end of the prefix name. In this case, we named our two MA presets with suffixes _twenty and _hundred.
With the presets defined, the entry of technical indicator tokens can proceed without pre-defining the tokens and without user prompting. Open a new scan setup window and enter the formula ma_twenty.1 < ma_hundred.1 and ma_twenty > ma_hundred
When you then press the "Check" (or "Scan" or "Save") button Investor/RT will automatically create the two MA tokens giving them names ma_twentry and ma_hundred. The setups for these two indicators will be obtained from the MA presets found with the same suffixes. The scan is fully specified with no user prompting windows. In essence, the creation of indicator presets with suffixed names makes the suffix visible to the RTL language. Note that the same suffix can be used in names of various indicators. For example, you could have a MA preset and an RSI preset both having names suffixed with "_twenty". Thus you can write ma_twenty or rsi_twenty and Investor/RT will correctly obtain the preset preferences without user prompting.
In the event no preset is found with the appropriate suffix, Investor/RT will also check to see if it can find a preset having a full name that exactly matches the suffix following after the underscore. For example, if you make a preset named emaTen to refer to a MA token with a setup of 10 period exponential moving average, then the token MA_emaTen can be used to refer to that MA preset. The full name of the preset follows the underscore. Note that comparisons are case sensitive, thus MA_ematen would not be recognized as a reference to the preset, while ma_emaTen and MA_emaTen will work. The token before the underscore in not case sensitive, but the suffix must match exactly.
How presets are named is up to each individual user. If you use short preset names, like emaTen or stochRSI, you can refer to those presets using RTL tokens using the full name. Longer names are more descriptive but would be laborious to enter and hard to remember. With longer preset name, an underscore suffix on the longer name gives you a shorter handle for referring to the preset.
Referencing Scan, Signal, Custom Indicator Names
The indicator tokens SCAN and CI follow the same conventions described above for technical indicator tokens. If you have a custom indicator named "StochasticRSI" you can create a preset for this CI and name it "myStochasticRSI_srsi" for example. Once this preset is defined, the token CI_srsi (or ci_srsi) will be recognized in RTL formulas. When creating a new custom indicator formula it is often useful to refer to other custom indicators or scans (signals). Presets may not exist for each custom indicator, so Investor/RT handles the CI and SCAN tokens further when no matching preset is found. The rule is as follows:
A SCAN or CI token, when followed by a suffix, will be associated with the scan or ci preset having that same suffix. If there is none, the scan or ci token will be associated with the scan, signal, or custom indicator whose full name matches the suffix. If there is none with that name, the user will be prompted to name the associated scan, signal or custom indicator.
Suppose for example you have two custom indicators with names: StochasticRSI and SpecialAverage, a signal named "myBuySignal", and a CI preset for StochasticRSI named myStochasticRSI_srsi. Here are a few RTL tokens for making reference to these:
CI_myBuySignal (no prompt)
ci_myBuySignal (no prompt)
ci_mybuysignal (user will be prompted since the name match is case sensitive)
ci_srsi (no prompt, reference StochasticRSI via the preset)
ci_StochasticRSI (no prompt, references StochasticRSI directly by name)
scan_myBuySignal (no prompt)
When entering formulas, it may sometimes be useful to review a list of all defined custom indicator names or signal/scan names as an aid to entering the correct spelling of the name or suffix. This can be accomplished by clicking the RTL button on the main toolbar. Choose Open Custom Indicator from the ensuing popup menu to see a list of all custom indicators. The list of names can be dismissed at any time without actually opening anything by clicking the close box in the window title bar.
Note that the special handling of RTL technical indicator tokens that have an underscore suffix is a formula writing convention that speeds entry and setup of RTL formulas. The RTL language itself has not changed. You can still setup indicator tokens in advance of entering your formula syntax and you can assign names to tokens with or without an underscore suffix. All scans, signals, and custom indicators correctly setup before these improvements will continue to function as before.