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

Re: [amibroker] Bars since Buy signal - how to code in AFL ?



PureBytes Links

Trading Reference Links

Anthony Faragasso wrote:

>Buy = Cross( MACD(), Signal());
>
>Short=Cross(Signal(),MACD());
>
>Long = Flip(Buy,Short);
>
>Days = IIf(Long,BarsSince(Buy),BarsSince(Short));
>
>Plot(C,"",colorBlack,styleCandle);
>
>PlotShapes(Buy*shapeUpArrow,colorGreen);
>
>PlotShapes(Short*shapeDownArrow,colorRed);
>
>
>
>Title=Name()+ WriteIf(Long," BarsSinceBuy [ "+WriteVal(Days,1)+ "]","BarssinceShort ["+WriteVal(Days,1)+ "]");
>
>  
>
The logic in this implementation assumes that the buy and sell/short 
come alternatively, it may have difficulty to handle multiple buy 
signals coming before the sell, as kaveman has found out in the previous 
post.



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

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

<*> 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/