Авторы: 159 А Б В Г Д Е З И Й К Л М Н О П Р С Т У Ф Х Ц Ч Ш Щ Э Ю Я

Книги:  184 А Б В Г Д Е З И Й К Л М Н О П Р С Т У Ф Х Ц Ч Ш Щ Э Ю Я

Getting Ahead of the Game

There’s one other thing you can do with variables. Several can be created and stored in a

formula. These can be referenced later in other formulas through a function very similar to

Fml(). Those familiar with other programming languages will recognize this as similar to

creating a header file.

The principle here is to avoid having to retype the same expression in every indicator and/or

formula you write. In the formula Weekly Volume, the DayofWeek() function was used to see if

the period being checked was a Friday. If you find yourself writing formulas that check this

frequently, it might be easier to create variable name “Friday.” Store this variable in an

indicator, perhaps named “header.” Then whenever you needed to check if it was a Friday, you

could reference the Friday variable in the header indicator.

This example is admittedly a little weak. You would probably type more text referencing the

variable that you would entering the DayofWeek() function. However, if you had a longer

mathematical expression, this could definitely save you time retyping it for every formula. You

also don’t have to worry about making any typos and if you decide to change it, you only have to

edit one indicator and change one expression.

The full text of the new function is listed below.

Formula Variable Call



FUNCTION Calls the custom indicator named

FORMULA_NAME and returns the value

contained in the custom indicator's variable


Both the formula's name and the variable's

name must be contained in quotation marks

(e.g., fmlvar( "Secret A", "MyVar")).

If you change a formula or variable name,

you must also change any fmvarl() calls that

reference that formula and variable.

EXAMPLE fmlvar("MyIndicator", "MyVariableA" )

When inserting this function in a formula, it is strongly urged to use the functions button, just

like you would in adding a Fml() function. When you look at the list of custom indicators, any

indicator with a variable in it will have a listing for the indicator itself and another listing for

each variable in the indicator. The variables are listed after the indicator’s name and are

enclosed in parentheses.