Trading system toolbox
|SYNTAX||ValueWhen(EXPRESSION, ARRAY, n = 1)|
|FUNCTION||Returns the value of the ARRAY when the EXPRESSION was true on the n -th most recent occurrence. Note: this function allows also 0 and negative values for n - this enables referencing future|
|EXAMPLE||valuewhen( cross( close, ma(close,5) ) ,macd(), 1)|
The ValueWhen function is used in the following formulas in AFL on-line library:
See updated/extended version on-line.