Questions about Functions
Questions about Writing Functions
How can I add additional processing to a function I have written?
From the Modify Function Definition: Formula page, select the portion of the formula that you would like to add processing around. Then, select the Special sub-page and press the Add Level button. This will add an Identity function around the selected section. This identity function adds no additional processing in itself; however, it can now be selected and replaced with another function definition.
How can I specify the end of the range for functions that take a period as an input?
Many functions, such as Summation, Moving Average, Highest, and Lowest, that take a period of time as an input. In most cases, this period is the number of samples to include in the calculation, up to and including the current sample. However, there are times when it may be desirable to calculate these values for a range that does not include the current example. For example, you may want to calculate the highest value between 10 and 14 bars ago.
You can do this by using the Lag function around the function you are performing. The Lag function delays the value of its input by a specified number of samples. Therefore, you can use this function to report a previous value of functions such as the Summation, Moving Average, Highest, and Lowest.
For example, calculating the highest value between 10 and 14 bars ago could be entered as Lag(Highest(Value,5),10). In other words, the highest value over a period of 5 bars from 10 bars ago.
Questions about Calculated Fields
Why are there empty cells at the start of some of my calculated fields?
Empty cells represent null values. Null values are typically produced when there is not sufficient data to calculate a value. This can be due to one of the inputs to a calculation or prediction being null, or a calculation or prediction requiring a previous value that is not yet available. For example, a moving average is an average of the current value with the specified number of previous values. A moving average of ten requires nine previous values to be calculated. Therefore, the first nine records for a moving average will be null.
Empty values are propagated. For example, a moving average of a moving average will be empty until the first moving average has enough values to calculate the second moving average. In this case, a moving average of ten of a moving average of ten will begin with eighteen null values – nine for the first moving average and nine for the second.