CompoundValue ( IDataHolder historical data);
historical data: 1
Calculates a compound value according to following rule: if a bar number is greater than
length then the
visible data value is returned, otherwise the
historical data value is returned. This function is used to initialize studies with recursion.
|length||1||Defines length with which the bar number is compared.|
|visible data||-||Defines data to be returned if bar number exceeds the specified length.|
|historical data||-||Defines data to be returned if bar number is less than or equal to the specified length.|
def x = CompoundValue(2, x + x, 1);
plot FibonacciNumbers = x;
The example calculates the Fibonacci sequence. Starting from the third bar each following number is calculated as the sum of the previous two numbers while the numbers for the first two bars are equal to one. As a result you will get a plot containing values 1, 1, 2, 3, 5, etc.