PureBytes Links
Trading Reference Links
|
Maybe your code simply does NOT converge in such situation
and in fact this causes endless loop for real.
If that's the case, why don't you simply add a check for minimum
number of bars?
if( BarCount > 100 )
{
do { ....
Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: "peakwk79" <phaser2679@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Saturday, September 01, 2007 1:22 AM
Subject: [amibroker] Re: Endless loop error in Elder System price chart
> Hi Tomasz,
>
> Increasing the threshold merely increases the length of time I have to
> wait before the same error appears. My guess is the root of the
> problem is that the code needs a minimum number of quotations to
> complete the drawing and generates this error when there aren't enough
> quotations.
>
> To recap, the error message is:
>
> ####################
> )/LookBkPd ;
> OP = LastValue(OuterPct) ;
> X=X+sign( OP - ExternalBarPct )*deltaX ;
> deltaX = deltaX/2 ;
>
> Error 14: Endless loop detected in DO-WHILE loop
> ####################
>
> The whole code for the price chart is as below:
>
> =============================
> // Daily Bar Chart
> _SECTION_BEGIN("Elder Daily Chart with Envelope");
> SetChartOptions(0,chartShowArrows|chartShowDates|chartWrapTitle);
> Plot( EMA(C,13),"EMA(13)",colorDarkBlue,styleThick);
> //PlotForeign(GetBaseIndex(),IndustryID(1),colorBlack,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, "EMA(22)", colorRed, styleLine) ;
> //Plot( Middle, "MA", colorRed, styleLine|styleNoTitle ) ;
>
> Plot( Middle+X, "MA", colorGreen, styleDashed|styleNoTitle ) ;
> Plot( Middle-X, "MA", colorGreen, 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 |
> styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
>
> _SECTION_END();
> =============================
>
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@xxx> wrote:
>>
>> Hello,
>>
>> Tools->Preferences->AFL
>> increase "endless loop detection threshold".
>>
>> Best regards,
>> Tomasz Janeczko
>> amibroker.com
>
>
>
>
> 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
>
>
>
>
>
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/
|