How to hide price label on all bars but the last one

Hello,

I'm trying to hide the price label, when the last bar is not visible in the chart window. But it appears that the LastVisibleValue() function has a bug. It skips the last bar and starts working from the 2nd one. Does anyone know a better solution?

Code:

Plot(C,"Close",colorDefault,IIf(LastVisibleValue(C)==LastValue(C),GetPriceStyle(),GetPriceStyle()|4096));

LastVisibleValue

AmiBroker Pro 6.28.0 x86

Your code is incorrect.

If you want to hide the label when NOT on the last bar, correct code is as follows:

nolabel = IIf( LastValue( Status("barvisible" ) ), 0, styleNoLabel );
Plot(C,"Close",colorDefault, GetPriceStyle() | nolabel );
3 Likes