Numbering Candle Back From Latest Candle

Hi, I need help Numbering Candle from the latest Candle.

For example, I like to Identify candle number 9 from the latest candle by numbering it. I can see it without counting it manually.

I tried to utilize this

SetBarsRequired( 1500, 1500 );

dn = DateNum();
newday = dn != Ref( dn, -1 );

BarsOfDay = BarsSince( newday ) /*+ 1*/;

printf( "Bars since new day: %g", BarsOfDay );

Plot( C, "Price", colorDefault, styleCandle );

bi = Barindex();
fvb = FirstVisibleValue( bi );
lvb = LastVisibleValue( bi );

yoffset = -20;
for( i = fvb; i <= lvb; i++ ) {
    PlotText( " "  + barsofday[i] , i , L[i], colorGreen, -1, yoffset );
}

But so far, I couldn't get it to work.

bi = BarIndex();
is_last_bar = bi == LastValue(bi);

num_bars = 9;
is_rev_last = Reverse(is_last_bar);
is_rev_bar = Reverse(BarsSince(is_rev_last) == num_bars-1);

Plot( C, "Price", colorDefault, styleBar );
PlotShapes( is_rev_bar * shapeDigit9,  colorRed, 0,  L );

30

5 Likes

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.