Request- Simple AFL for shape

#1
Hi,

Kindly provide the afl for below mentioned conditions:

1) C>REF(C,-2)
2) C<REF(C,-2)

I want to plot a small dot/diamond for condition one below price bar and for condition 2 above price bar.

Is it possible to start the above conditions by selecting the specific bar ?
Help appreciated.

Regards,
N
 

colion

Active Member
#2
x = IIf ( C>Ref(C,-2), 1, 0 );
y = IIf( C<Ref(C,-2), 1, 0 );
z = SelectedValue( BarIndex() );

Plot( C, "", colorPaleGreen, styleBar );

PlotShapes( IIf( BarIndex() > z AND ( x OR y ), shapeSmallCircle, Null ), IIf( x, colorRed, colorYellow ), 0, IIf( x, L, H ), IIf( x, -20, 20 ) );
 
Last edited:
#3
x = IIf ( C>Ref(C,-2), 1, 0 );
y = IIf( C<Ref(C,-2), 1, 0 );
z = SelectedValue( BarIndex() );

Plot( C, "", colorPaleGreen, styleBar );

PlotShapes( IIf( BarIndex() > z AND ( x OR y ), shapeSmallCircle, Null ), IIf( x, colorRed, colorYellow ), 0, IIf( x, L, H ), IIf( x, -20, 20 ) );
you added BarIndex() > z, is that to ensure only future bars are marked with circles & diamond?
 

Similar threads