PureBytes Links
Trading Reference Links
|
Just add a condition that the total number of bars must be more than the
required period
--
Cheers
Graham
AB-Write >< Professional AFL Writing Service
Yes, I write AFL code to your requirements
http://www.aflwriting.com
On 20/11/06, Tony <talcamo@xxxxxxxxx> wrote:
>
> I really like this piece of code( look at the bottom of the email)
> which I pulled from the AFL library.
> It allows us to verify price within bollinger bands. I have been
> using it successfully on uptrending stocks which bounce off the
> signal line back toward the upper bollinger band. The range is
> usually a safe bet.
>
> There is only one flaw in the AFL code.
> If a ticker has too few quotes it goes into an endless loop.
> ( at least i think thatis what the problem is). I have tried to
> figure it out but have not been successful
>
> INWK is a recent example. It returns an endless loop.
> INWK is in an uptrending stock ( first week on the IBD top 100)
> appearing to be moving back to the 20 sma and preparing for a bounce.
>
> When i try to view it in Amibroker the indicator returns an
> endlessloop detected.
> This is the exact error message ( below it is the actual AFL code):
> ----------------------------------------------------------
> OuterPct = 100*( Sum( Over, LookBkPd ) + Sum( Under,
> LookBkPd ))/LookBkPd ;
> OP = LastValue(OuterPct) ;
> X=X+sign( OP - ExternalBarPct )*deltaX ;
> deltaX = deltaX/2 ;
> ---------------^
> Error 14.
> Endless loop detected in DO-WHILE loop
> ------------------------------------------------------------
>
>
>
> This is the AFL indicator. Any help will be greatly appreciated.
>
> // Daily Bar Chart
> _SECTION_BEGIN("Elder Daily Chart with Envelope");
> SetChartOptions(0,chartShowArrows|chartShowDates);
> Plot( EMA(C,13),"EMA(13)",colorRed,styleLine);
> PlotForeign(GetBaseIndex(),IndustryID
> (1),colorGreen,styleLine|styleLeftAxisScale);
> LookBkPd = 100 ;
> AvgPd = 22 ;
> ExternalBarPct = 15 ;
> ConvergePct = 2 ;
> Middle = EMA( C,AvgPd ) ;
> Rng = HHV( H,LookBkPd ) - LLV( L,LookBkPd ) ;
> X = Rng ;
> deltaX = X/2 ;
> do
> {
> Over = H > Middle + X ;
> Under = L < Middle - X ;
> OuterPct = 100*( Sum( Over, LookBkPd ) + Sum( Under,
> LookBkPd ))/LookBkPd ;
> OP = LastValue(OuterPct) ;
> X=X+sign( OP - ExternalBarPct )*deltaX ;
> deltaX = deltaX/2 ;
> }
> while ( abs( OP - ExternalBarPct ) > ConvergePct ) ;
> Plot( Middle, "MA", colorLightGrey, styleLine|styleNoTitle ) ;
> Plot( Middle+X, "MA", colorBlue, styleDashed|styleNoTitle ) ;
> Plot( Middle-X, "MA", colorBlue, styleDashed|styleNoTitle ) ;
> _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %
> g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue(
> ROC( C, 1 ) ) ));
> Plot( C, "Close", ParamColor("Color", colorBlack ), styleCandle |
> ParamStyle("Style") | GetPriceStyle() );
> _SECTION_END();
>
>
>
>
> 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
>
>
>
>
>
Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.14.11/542 - Release Date: 11/20/2006
|