LastValue
- last value of the array

Trading system toolbox


SYNTAX LastValue(ARRAY, lastmode = True )
RETURNS NUMBER
FUNCTION Returns last calculated value of the specified ARRAY. The result of this function can be used in place of a constant (NUMBER) in any function argument.
If ARRAY is undefined (e.g., only 100-days loaded and you request the last value of a 200-day moving average) then the lastvalue function returns zero.
Caveat: since this function fills an entire data array with the last value of another array, it allows a formula to look into the future.

lastmode parameter:
(affects only commentary/interpretation)
When it is True - then true last value is used always
if it is False - then in commentary the 'selected' value is returned

In pre-4.08.1 versions commentary/interpretation/tooltip code evaluation was somewhat special because LastValue returned in fact not the last but the value of array at selected point (by vertical line or by tooltip) This caused some problems in displaying indicator values that used LastValue in its construction. To address this now LastValue used in Commentaries by default returns true last value. So you should modify your existing commentary/interpretation code that used LastValue to use now SelectedValue( array ) function to maintain the same behaviour. Alternatively you can use LastValue( array, 0 ).

EXAMPLE  
SEE ALSO   SELECTEDVALUE() function

References:

The LastValue function is used in the following formulas in AFL on-line library:

More information:

Updated on-line reference