November 5, 2007

In AFL the identifiers Open, High, Low, Close, Volume, OpenInt and Avg are reserved for price field arrays. Of the small number of variables that are reserved the price identifiers are the only ones that can be abbreviated (OHLCVOI can be used instead of the longer form).

They are not case sensitive and when entered into a formula, in the Formula Editor, they will default to upper case and bold (as shown in the figure below).

This is very nice for speeding up formula writing but there is a ‘Catch 22’.

If abbreviated identifiers are used it makes the task of finding and replacing price arrays, using Formula Editor >> Edit >> Replace very tedious e.g. if the ‘writer’ wants to replace all “C’s” with a variable = = ParamField, for example, the Replace tool will pick up every “C” in the code and ask the user to confirm the replacement.

Checking Match whole word only in the Text Search Tool will change the criteria so that where “C” is part of a word it will be passed over while “C”, on it’s own, will be treated as a word and highlighted in the search report .

Note: The font format for reserved variables can be customized in Tools >> Preferences.

A handy tip for searching, with the Text Search Tool, is to position the cursor at the top of the code so that the search will begin from there. If the cursor is lower down the code the search will start from there and it will only traverse to the end before reporting that the search is complete.