Appendix D: Studies and Server Macros

Notation and Definitions

In this document, we describe the formulas used by XMIM to compute the studies provided. We will use the following notational conventions throughout. The studies will be presented in the form:

where name is the name of the study/built-in in question, X, and Y are the attribute arguments, and n specifies the time period in the study/built-in. For example, we will write the n day move of X as

and we would specify the 10 day move of Close of SP as

In addition, if X is an attribute, we will use the notation X i to denote the value of X i units ago. In particular, X 0 is equivalent to X. For example, the n day move of X is given by

.

To completely specify the definition, we also have to describe the treatment of missing values or NaNs. For clarity, we do not give the treatment of NaNs in the mathematical definition of the study, except in cases where it is absolutely essential (e.g., the definition of count). Instead, we explain the treatment of NaNs in an informal manner, following the mathematical statement. In the case of move, for example, if the value of X or X n is a NaN, XMIM will consider the preceding value in each case, i.e., X 1 or X n+1. This gives a total of four possible formulas, depending on the actual values in the data. Moreover, some studies have other forms of special treatment, to account for the special parlance of the market. In the case of move, for example, the 1 day move of Open of SP actually refers to the difference between the Open and the previous Close, not the previous Open. Such behavior will also be mentioned following the definition, not as part of the explicit mathematical statement.