LAST() Function

Author: Optuma Team Last updated: Jun 10, 2020 00:42

Every bar on a chart has a Close price which is the last price of that bar, but only the final, current bar on the right hand edge has the Last price. That is, the close price of the last bar is LAST. The reason to use this function is that sometimes you want to know the very last price and Last() is an easy way to get that. The LAST() function will return the current value of a price bar (closing value by default) or indicator (see also FIRST() function).

If you apply a Show Plot with just LAST() as the formula by default it will plot a horizontal line at the last closing price. Change the formula to LAST(HIGH()) to plot at the last high value.

This example compares Show Plot with LAST(HIGH()) in blue vs HIGH() in green. Similarly, if LAST() Show Plot is applied to an indicator, eg the Relative Index Comparison tool it will draw the last value across the screen:

LAST() Function

For more examples using LAST() with BARDATE() see this forum post.