Hi,

No need for using BarIndex or LastValue. As Bill suggested earlier, 
just set the Buy/Sell and use PlotShapes to draw all the arrows at 
the Buy/Sell signal. Cross is the correct function to use for your 
signals.

periods = Param("Periods", 21, 2, 200, 1 );
ROCpds = ROC( C, periods );
ROCadj = periods * EMA( ROC( C, 1 ), periods );

Buy = Cross( ROCadj, ROCpds );
Sell = Cross( ROCpds, ROCadj );

Plot( ROCadj, "ROCadj "+periods, colorRed, styleThick );
Plot( ROCpds, "ROC "+periods, colorBrightGreen );

PlotShapes( IIF( Buy, shapeUpArrow, shapeNone ), colorBrightGreen );
PlotShapes( IIF( Sell, shapeDownArrow, shapeNone ), colorRed );

Mike

--- In [email protected], "aboaziz_sa" <[EMAIL PROTECTED]> wrote:
>
> this will do!
> 
> 
> 
> crossup= Cross( ROCadj , ROC( C, periods )) ;
> crossdown= Cross( ROC( C, periods ), ROCadj ) ;
> x = LastValue(ValueWhen(crossup, BarIndex(), 1));
> PlotShapes(IIf(BarIndex() == x, shapeUpArrow, Null), 
colorBrightGreen);
> y = LastValue(ValueWhen(crossdown, BarIndex(), 1));
> PlotShapes(IIf(BarIndex() == y, shapeDownArrow, Null), colorRed);
>


Reply via email to