### Syntax of Chartable Expressions

A chartable expression can consist of symbols, fields, operators, functions and numbers. The basic steps to insert an expression are always the same. For more information about the possibilities of chartable expressions, see the detailed syntax description below.

To insert a chartable expression  basic steps

▪       In the chart pane where you want to insert the expression, type an equal sign = to start the chartable expression.

▪       Do one of the following:

-       In the list that appears, double-click a symbol or a TeleTrader function.

-       Press the Escape or Backspace key to make the list disappear and type parts of the expression manually. While typing, appropriate functions are recommended automatically. For example, typing an S will show a list with all functions starting with S.

▪       Continue creating your expression using the syntax described below. Appropriate lists appear after using symbols, operators or functions.

▪       After you have finished writing the expression, press the Enter key. The expression is now added to your chart.

Syntax of chartable expressions

More examples

 =[GOOGLE INC. (NASDAQ)]*3 Multiply the Close price of the Google stock by three. Note that no field was specified  therefore, the expression automatically uses the CLOSE field. =[DAX P-IN. (INDICES XETRA)].CLOSE* [EUR/USD SPOT (FOREX GTIS BASIC FX SNAPSHOT)].CLOSE Multiply the Close price of the DAX symbol with the EURUSD rate. =([DOW JONES INDUSTRIAL AVERAGE INDEX (INDICES DOW JONES)].HIGH+[DOW JONES INDUSTRIAL AVERAGE INDEX (INDICES DOW JONES)].LOW+[DOW JONES INDUSTRIAL AVERAGE INDEX (INDICES DOW JONES)].CLOSE)/3 Add the High, Low and Close for the DJIA and divide it by three. (This calculation is also called the typical price, used for example in the Commodity Channel Index.) Note that you can use the same symbol with different field values in one expression. For this rather complex expression, you have to manually enter round brackets to force the correct operator precedence.

Besides using the on-the-fly assistant for inserting expressions, you can also insert an expression by manual typing over the chart area. Typing over the chart area works only if the on-the-fly assistant is disabled. You can enable / disable the on-the-fly assistant by using the option Turn off automatic display of assistant for chartable expressions under Tools > Options > Chart > Expressions.

Note             Turn off automatic display of assistant for chartable expressions is activated by default.

By inserting a chartable expression by manual input, it is possible to:

▪       Insert a simple chartable expression (one symbol with simple numeric operations)

▪       Insert a chartable expression with analysis tools (indicator or study)

▪       Insert a complex chartable expression (using multiple studies with several entities / properties with multiple numeric operations and with complex tickers)

Chartable expressions entered by manual typing - important characteristics

▪       To insert a chartable expression, enter "=" (equal) sign. This sign is also used to delete a previously typed expression.

▪       To add an additional expression, without deleting the first one, enter "," (comma) sign, and continue typing an expression.

▪       To delete existing chartable expression, enter "-" (hyphen) sign, and continue typing an expression.

▪       It is possible to add a new and delete existing chartable expression in a single command.

▪       If a symbol referenced in an expression doesn't exist on a chart, it will be automatically added (and hidden) after the expression is added by pressing the Enter key or Tab key. When the symbol is hidden, its name is not visible in the chart header.

▪       If a symbol ticker (unique symbol name) contains the special character "-", it can be wrongly interpreted as the mathematical minus operator. Such names must be enclosed with square brackets when entered in an expression. For instance: Symbol ticker IEC-W1-2, must be entered in expression as [IEC-W1]-2.

▪       If the type of a price (e.g. Open, High, Low or Close) is not defined when the symbol was entered in an expression, Close price will be automatically used for all symbols referenced in the expression.

▪       If a symbol referenced in an expression cannot be found (i.e. unique name / ticker is not correct), an error message appears.

Insert simple chartable expression by manual typing

To insert simple chartable expression  an example

▪       Open chart document for PTT symbol

▪       Type =(BBL+SCB+KBANK)/3 and press Enter key

▪       Expression (BBL+SCB+KBANK)/3 is added to chart and replace PTT symbol, while symbols BBL, SCB and KBANK are hidden

To insert two simple ratios as chartable expressions  an example

▪       Open chart document for BBL symbol

▪       Type =BBL/SET and press Enter key

▪       Type ,=SCB/SET and press Enter key

▪       Both expressions are added to chart

Warning    If you do not enter "," (comma) character before typing second expression, previous expression will be deleted!

Insert chartable expression with analysis tools by manual typing

Besides using symbols values like Open, High, Low, Close and Volume, you can also use analysis tools (indicators and studies). As with any manual typing of expressions, this is possible only if On-The-Fly assistant is turned off.

You can insert expression which includes indicator regardless if that indicator is visible or not visible on a chart. Indicator inserted in expression will be automatically added to chart as hidden object and use compression of the main chart.

See the syntax for manual typing of expression that include analysis tools (indicators and studies) in the table below:

Function_at(BaseSymbol1UniqueName.FidName,,BaseSymbolXUniqueName.FidName,Parameter1Value,, ParameterXValue).EntityName.PropertyName

 Parameter Description Function_at Analysis tool function name (can be found in Study Info / Function field), with fixed suffix _at BaseSymbolXUniqueName Unique name(s) of base symbol(s) for the analysis tool FidName Open, High, Low or Close. If there is no fid name, Close value is used. ParameterXValue Optional value for analysis tool parameters. Parameters should be given in the order as in Parameters dialog. If trailing parameter(s) are omitted, their default value(s) are used EntityName/PropertyName Entity and property name for analysis tool with several entities, e.g. Bollinger Bands: ▪       Has two entities: Boll(Area) and Mid(Line). ▪       Each area has two properties: Upper and Lower. ▪       Each line has one property: Value. ▪       Each marker has three properties: Price, Direction and Text.

To insert chartable expression with Moving Average Simple study  an example

▪       Open chart document for any symbol

▪       Type =movs_at(SCB,30,2) and press Enter key

▪       Moving Average Simple study will be plotted on a chart for SCB symbol, with 30 bar period and 2 bar shift

In the table below, you can see examples for different types of expression formats and studies:

 Expression format Action taken movs_at(SCB) Inserts Moving Average Simple for SCB with period=21, shift=0 movs_at(SCB,30) Unique name(s) of base symbol(s) for the TA movs_at(SCB,30,2) Inserts Moving Average Simple for SCB with period=30, shift=2 indCorrelation_at(SCB,PTT,21) Inserts Correlation for SCB and PTT with period=21, shift=0 boll_at/(SCB.HIGH,30).Boll.Upper Inserts Bollinger band TA with SCB base symbol, HIGH fid, period=30, over Upper value of Boll area of the TA.

Insert chartable expression with analysis tools on overlaid symbols by manual typing

▪       When inserting a study on a chart with overlaid symbols, study will be added for each of available symbols on a chart. If there is only one symbol with a study on a chart, adding an overlay symbol will automatically add an additional study based on newly added symbol.

▪       If multiple symbols are displayed on a chart, and each of them has a different study, inserting a new overlay symbol will automatically add a study like the one applied to the chart main symbol.

▪       If multiple symbols are displayed on a chart, and each of them has a different study, inserting two or more overlay symbols will automatically add same number of studies like the one applied to the chart main symbol.

To insert chartable expression with Moving Average Simple study on overlaid symbols

▪       Open chart document with three overlaid symbols: BBL, SCB and KBANK.

▪       Type =movs_at() and press Enter key.

▪       Moving Average Simple study will be plotted on a chart for all three symbols: BBL, SCB and KBANK, with 30 bar period and 2 bar shift.

In the table below, you can see examples for different types of expression formats and studies:

 Chart setup Expression format Action taken Overlay chart with: BBL, SCB and KBANK ,=MOVS_AT() Inserts Moving Average Simple study for BBL, SCB and KBANK with period=21, shift=0 Overlay chart with: BBL, SCB and KBANK ,=MOVS_AT(,12) Inserts Moving Average Simple study for BBL, SCB and KBANK with period=12, shift=0 Overlay chart with: BBL, SCB and KBANK ,=MACD_AT(12,15,5) Inserts MACD study for BBL, SCB and KBANK with parameters 12, 15, 5

Insert complex chartable expression by manual typing

Besides using simple analysis tools (indicators and studies) with only one entity / property, you can insert expression based on analysis tools that have two or more entities and properties. As with any manual typing of expressions, this is possible only if On-The-Fly assistant is turned off.

You can insert expression which include indicator regardless if that indicator is visible or not visible on a chart. Indicator inserted in expression will be automatically added to chart as hidden object and use compression of the main chart.

To insert chartable expression with multiple entities / properties  an example

▪       Open chart document for any symbol

▪       Type =move_at(BBL,25)/move_at(SCB,25) and press Enter key

▪       Ratio of two moving averages based on BBL and SCB symbols will be plotted on a chart

To insert complex chartable expression  an example

▪       Open chart document for any symbol

▪       Type =(SCB.CLOSE+BBL.CLOSE)/(move_at(BBL,25)/move_at(SCB,25)) and press Enter key

▪       Expression is plotted on a chart based on calculation from expression: (SCB close price + BBL close price) / (moving average simple with period=25 based on BBL symbol / moving average simple with period=25 based on SCB symbol).

Insert studies by manual typing

Besides inserting expressions based on a study, you can also insert studies by manual typing. This is the same action, as if you right-click on a chart area and select Insert Study from a context menu.

To insert study by manual typing  an example

▪       Open chart document for PTT symbol

▪       Type MOVS() or MOVS(PTT) and press Enter key

▪       Moving Average Simple study for PTT symbol is plotted on a chart

See the syntax for manual typing of analysis tools (indicators and studies) in the table below:

 Chart setup Expression format Action taken Overlay chart with: BBL, SCB and KBANK ,MOVS() Inserts Moving Average Simple study for BBL, SCB and KBANK with period=21, shift=0 Overlay chart with: BBL, SCB and KBANK ,MOVS(BBL) Inserts Moving Average Simple study for BBL only, with period=12, shift=0 Overlay chart with: BBL, SCB and KBANK ,MOVS(BBL,10) Inserts Moving Average Simple study for BBL only, with period=10, shift=0 Overlay chart with: BBL, SCB and KBANK with SMA study calculated on all three symbols ,RSI() SMA and RSI studies based on BBL, SCB and KBANK symbols are displayed on a chart.

Note             There are several limitations regarding chartable expression with analysis tools on overlaid symbols: Multi-base studies (e.g. Correlation) and market breath studies (e.g. Coppock Breadth) are not currently supported.
Also, inserting the same study on multiple curves (symbols, expressions etc.) is only available by typing a chartable expression, but not trough Insert Study dialog from a Chart context menu.

Replace existing chartable expression by manual typing

To replace existing chartable expression  an example

▪       Open chart document with three overlaid symbols: PTT, PTTEP and TOP

▪       BBL and SCB symbols replace PTT, PTTEP and TOP symbols on the chart.

 Expression type Initial Setup Deletion Typing Command Outcome Symbols PTT, PTTEP, TOP BBL,SCB BBL and SCB BBL,SCB PTTEP PTTEP PTTEP SET,BBL,PTT SET, BBL and PTT Ratios PTT/SET and TOP/SET =BBL/SET,=KBANK/SET BBL/SET and KBANK/SET Studies First create a study called MyIndex BBL/MYINDEX and SCB/MYINDEX =KBANK/MYINDEX_AT(SYMBOL), =BAY/MYINDEX_AT(SYMBOL) KBANK/MYINDEX and BAY/MYINDEX Mix of symbols, expressions and studies ADVANC, SHIN and INTUCH =CPN/PROP,=CK/PROP,PROP,SET CPN/PROP, CK/PROP, PROP and SET

▪       Open chart document with three overlaid symbols: BBL, PTT and SCB

▪       CPF and CPN symbols are added on a chart along with three other symbols: BBL, PTT and SCB.

 Expression type Initial Setup Deletion Typing Command Outcome Symbols PTT, PTTEP, CPN ,CPF,BBL PTT, PTTEP, CPN, CPF and BBL Ratios BBL/SET and CPF/SET ,=PTT/SET,=PTTEP/SET BBL/SET CPF/SET PTT/SET PTTEP/SET Studies First create a study called MyIndex BBL/MYINDEX and SCB/MYINDEX ,=KBANK/MYINDEX_AT(SYMBOL) ,=BAY/MYINDEX_AT(SYMBOL) BBL/MYINDEX, SCB/MYINDEX, KBANK/MYINDEX, BAY/MYINDEX Mix of symbols, expressions and studies BBL/SET, CPF/SET ,=PTT/SET,CPN BBL/SET, CPF/SET, PTT/SET and CPN

Delete existing chartable expression by manual typing

To delete existing chartable expression  an example

▪       Open chart document with three overlaid symbols: BBL, PTT and SCB.

▪       Delete two symbols by typing ,-BBL,-PTT and press Enter key.

▪       Only SCB symbol remains on a chart.

 Expression type Initial Setup Deletion Typing Command Outcome Symbols PTT PTTEP TOP ,-TOP,-PTTEP PTT Ratios PTTEP/PTT TOP/PTT PTT/SET KTB/SET ,-=TOP/PTT,-=PTT/SET PTTEP/PTT and KTB/SET Studies First create a study called MyIndex BBL/MYINDEX ,-=BANK/ MYINDEX_AT(SYMBOL),-=BAY/ MYINDEX_AT(SYMBOL) BBL/MYINDEX and SCB/MYINDEX Mix of symbols, expressions and studies PTTEP/PTT  KTB/PTT PTTEP KTB,SET ,-=PTTEP/PTT,-SET KTB/PTT and KTB

Warning    Symbols that are used for calculating the expressions (such as ratios), are set to hidden mode. If you execute deletion command which contains a symbol that is used for calculating an expression, this expression will also be removed, because its base symbol does not exist anymore.
For example, if you have PTT/SET,BBL expression displayed on a chart, and execute deletion command
,-=SET only BBL symbol will remain on the chart.

Simultaneous adding and deleting a chartable expression by manual typing

To add and delete a chartable expression  an example

▪       Open chart document with three overlaid symbols: BLA, PTT and SCB.

▪       Enter chartable expression command ,-BLA,BBL and press Enter key.

▪       BLA is removed from a chart while BBL is added on a chart along with two existing symbols: PTT and SCB.