[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: help needed for this formula



PureBytes Links

Trading Reference Links

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 amibroker@xxxxxxxxxxxxxxx, "aboaziz_sa" <aboaziz_sa@xxx> 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);
>



------------------------------------

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/