This is a AFL for Bar Numbers with good options.However, it is not printing anything when I apply it to a chart( daily chart).Can you spot the glitches ?
Thanks.
plot_interval = param("Plot bar num interval", 5, 1, 500, 1);
bar_num_font = paramstr("Font for bar number", "Corbel");
bar_num_font_size = param("Font size for bar number", 8, 1, 10, 1);
bar_num_color = paramcolor("Color for bar number", colorgrey40);
bar_num_align = param("Alignment for bar number", 30, 0, 100, 1);
bar_num_angle = param("Angle for bar number", 0, 0, 3600, 1);
bar_num_offset = param("Bar number offset", 1, 0, 200, 1);
bar_num_pos = paramtoggle("Bar number plot position", "Below Low|Above High", 0);
if (interval() < indaily) {
newday = datenum() != ref(datenum(), -1);
count = 0;
gfxsetbkmode(1);
gfxsetcoordsmode(1);
gfxsettextalign(bar_num_align);
gfxsettextcolor(bar_num_color);
gfxselectfont(bar_num_font, bar_num_font_size, 400, false, false, bar_num_angle);
first_visible_bar = status("firstvisiblebar");
last_visible_bar = status("lastvisiblebar");
for (i = first_visible_bar; (i < last_visible_bar) and (i < barcount); i++) {
if (newday[i]) {
count = 1;
}
if (count % plot_interval == 0) {
x = i;
if (bar_num_pos) {
y = h[i] + bar_num_offset;
} else {
y = l[i] - bar_num_offset;
}
gfxtextout(strformat("%.0f", count), x, y);
}
count++;
}
}