Put the arrow above the bar 14 days from today

Hello everyone,

I try to put a small arrow above the bar that 14 days previous from today. I try to code like below but it did not work. Please help.

Cond1 = IsNull(Ref(C,14))== True;
Cond2 = IsNull(Ref(C,13)) == False;

Cond = Cond1 AND Cond2;

PlotShapes(shapeDownArrow * Cond,4,0,H);

Here you go:

_SECTION_BEGIN( "Tracing Prev. Bars" );
	 bi = BarIndex();
	 fvb = Status( "firstvisiblebar" );
	 per = Param( "Period", 14, 1, 200, 1 );

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

	 SelBar = 0; //Selected Bar
	 for( i = BarCount - 1; i > fvb; i = i - per )
	 {
		 SelBar[ i ] = bi[ i ];
	 }
	 PlotShapes( IIf( SelBar, shapeDownArrow, Null ), ParamColor( "Arrow Color", colorBlue ), 0, H, -12, 0 );
_SECTION_END();

Would be a learning if someone can remove the loop for the same output.

Cheers!

1 Like

@Lennon, @chuquangkhue you can try this:

Bi = BarIndex();
Condition = Bi == LastValue(Bi) - 14;
PlotShapes(Condition * shapeDownTriangle, colorYellow);
Plot( C, "C", colorDefault, styleCandle );

Cond

3 Likes

Thank you Milosz and Lennon,

I have got what i want. Thank you so much!

Bi = BarIndex();

Condition = Bi == LastValue(Bi) - 13;

PlotShapes(shapeDownArrow * Condition,colorBlue,0,H);
image