Created an indicator to show the ranking of the latest close within the past N bars. However the indicator's curve changes as the cursor moves across the chart.
Amibroker version is 5.9.0.
_SECTION_BEGIN("Close Ranking");
// Parameters
period_length = Param("Period length", 26, 5, 50, 1);
number_of_bars = Param("Number of Bars for Ranking", 400, 20, 500, 10);
availableBars = Min(BarIndex()+1, number_of_bars);
closeRanking = PercentRank(Close, selectedvalue(availableBars)) / 100;
Plot(closeRanking, "1DC", colorGreen, styleLine);
_SECTION_END();
In the screenshots, moving the cursor causes the indictor in the bottom pane to change shape.
Any ideas? Does using a later version fix it?