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

Re: [amibroker] Re: Writing a fib cluster indicator


  • Date: Tue, 29 Dec 2009 11:13:43 -0500
  • From: "wavemechanic" <fimdot@xxxxxxxxxxxxxx>
  • Subject: Re: [amibroker] Re: Writing a fib cluster indicator

PureBytes Links

Trading Reference Links



In re use of public forum stuff it's a bit more complicated.  Yahoo's TOS (particularly section 10 and 11) address copyright/license issues.
----- Original Message -----
From: reinsley
Sent: December 29, 2009 3:12 AM
Subject: Re: [amibroker] Re: Writing a fib cluster indicator


Wise,


If your question is about Thomas Zmuck, you can see in the comments that
he created a commercial site to sell formulas.

http://www.amibroker.com/library/detail.php?id=216&hilite=ISEMPTY

One of his commercial formula (patternexplorer) looks like the one
provided by archives many years before.

IMO, everything published in a public forum falls into a public domain
although I am not a jurist.

Out of courtesy is to mention the author's name if it's known but in
this case, maybe you should ask his opinion up to what you want to do.

Best regards



Le 28/12/2009 21:21, wooziwog a écrit :
>
>
> Wise - what formula are you referencing? There are several formulas in
> the post, Reinsley provided links to two of them and the third one that
> is a work in progress.
>
> David K.
>
> --- In amibroker@xxxxxxxxxxxxxxx <mailto:amibroker%40yahoogroups.com>,
> "wisestocktrader" <wisestocktrader@xxx> wrote:
>  >
>  > Can somebody here upload this formula to the following site:
>  > www.wisestocktrader.com
>  > It looks like a really good formula and it would be a shame to keep
> it buried in posts. If nobody does may i upload it myself?
>  >
>  > --- In amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com>, reinsley <reinsley@> wrote:
>  > >
>  > >
>  > >
>  > > Hi Kevin,
>  > >
>  > > When I discovered AB world, I grabbed many formulas or pieces of code
>  > > and I made a tremendous mistake.
>  > > I did not note the author's name and the place where the formulas came
>  > > from. Sometimes the name was included, sometimes not.
>  > >
>  > > As much as possible I quote the author's name if I know it or if I
> find
>  > > it easily.
>  > >
>  > > Anyway I am never the inventor as my programming skill is pathetic.
>  > > Sometimes I am successful to modify the existing.
>  > >
>  > > After a while I recorded more information in my own AB bible.
>  > >
>  > > Sometimes its a code found in comments or in the forums, it's
> difficult
>  > > to remember the source.
>  > >
>  > > Concerning this formula, it's a personnal mod of a modified example.
>  > > After a deep search, the chances are strong that the original was from
>  > > an archives post :
>  > >
>  > > //Date: 12-January 2002 by Thomas Zmuck
>  > > //thomas.zm@
>  > > found into
>  > > http://www.mail-archive.com/amibroker@xxxxxxxxxxxxxxx/msg30211.html
> <http://www.mail-archive.com/amibroker@xxxxxxxxxxxxxxx/msg30211.html>
>  > >
>  > > I appreciate this formula as there is no loop.
>  > >
>  > >
>  > >
>  > > During my research I saw also this interresting contribution into AB
>  > > library :
>  > >
>  > > // Fibonacci Internal and External Retracements
>  > > // http://www.amibroker.com/members/library/detail.php?id=1084
> <http://www.amibroker.com/members/library/detail.php?id=1084>
>  > > // David K aka wooziwog
>  > >
>  > >
>  > > Best regards
>  > >
>  > >
>  > >
>  > >
>  > >
>  > >
>  > > Le 24/12/2009 03:39, kevinoversby a écrit :
>  > > >
>  > > >
>  > > >
>  > > >
>  > > > Thanks for the code Reinsley & David - great input - I will test
> them out.
>  > > >
>  > > > Reinsley - what is the source of that code - is there any
> information to
>  > > > go with it?
>  > > >
>  > > > My latest code is posted below for the retracements, along with this
>  > > > picture:
>  > > >
>  > > >
> http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/297290906/view?picmode=large&mode=tn&order=title&start=1&dir=asc
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/297290906/view?picmode=large&mode=tn&order=title&start=1&dir=asc>
>  > > >
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/297290906/view?picmode=large&mode=tn&order=title&start=1&dir=asc
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/297290906/view?picmode=large&mode=tn&order=title&start=1&dir=asc>>
>  > > >
>  > > > It seems to work well except the highestvisiblevalue is way off the
>  > > > screen after scrolling back a few days! (5.29 beta)
>  > > >
>  > > > Kevin
>  > > >
>  > > > // Add to blank pane
>  > > > // ATR on chart should be << swing size
>  > > > SetChartBkColor(ParamColor("Panel color ",1));
>  > > > Plot(C,"",2,64);
>  > > >
>  > > > m = Param("npeak",4,2,9,1); //number of minor peaks/troughs
>  > > > n = Param("perc",0.3,0.1,0.6,0.1); //approx. 1-8 point swings on ES
>  > > > bi = BarIndex();
>  > > >
>  > > > // Dominant visible swing
>  > > >
>  > > > Ly = LastValue((LowestVisibleValue(L)));
>  > > > Lx = LastValue(ValueWhen( L==Ly, bi, 1 ));
>  > > > Hy = LastValue((HighestVisibleValue(H)));
>  > > > Hx = LastValue(ValueWhen( H==Hy, bi, 1 ));
>  > > >
>  > > > if( Lx > Hx ) // dominant swing down
>  > > > {
>  > > > // add mirror of next section
>  > > > }
>  > > > else // dominant swing up & retracements
>  > > > {
>  > > > Plot( LineArray(Lx,Ly,Hx,Hy), "", colorPink,1 );
>  > > > Plot( Ly + .382 * (Hy-Ly),"",2,1);
>  > > > Plot( Ly + .500 * (Hy-Ly),"",2,1);
>  > > > Plot( Ly + .618 * (Hy-Ly),"",2,1);
>  > > > Plot( Ly + .786 * (Hy-Ly),"",2,1);
>  > > > z=IIf( bi>=Lx AND bi<=Hx ,Zig(C,n),Null);//Plot(z,"",colorRed);
>  > > >
>  > > > for(i=1;i<=m;i++) // minor swings & retracements
>  > > > {
>  > > > yt[i] = LastValue((ValueWhen( TroughBars(z,n)==0 , L, i )));
>  > > > xt[i] = LastValue((ValueWhen( TroughBars(z,n)==0, bi, i )));
>  > > > Cond1 = yt[i]== LLV(z,Hx-xt[i]); // lower lows only
>  > > > Plot(IIf(Cond1,LineArray(xt[i],yt[i],Hx,Hy),-1e10), "",
> colorPink,1 );
>  > > > Plot(IIf(Cond1, yt[i] + .000 * (Hy - yt[i]),-1e10),"",i+2,1);
>  > > > Plot(IIf(Cond1, yt[i] + .382 * (Hy - yt[i]),-1e10),"",i+2,1);
>  > > > Plot(IIf(Cond1, yt[i] + .500 * (Hy - yt[i]),-1e10),"",i+2,1);
>  > > > Plot(IIf(Cond1, yt[i] + .618 * (Hy - yt[i]),-1e10),"",i+2,1);
>  > > > Plot(IIf(Cond1, yt[i] + .786 * (Hy - yt[i]),-1e10),"",i+2,1);
>  > > > }}
>  > > >
>  > > > --- In amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com> <mailto:amibroker%40yahoogroups.com>,
>  > > > "wooziwog" <xcitemint@> wrote:
>  > > > >
>  > > > > Reinsley - I use fibs extensively - I started using the following
>  > > > method for intraday tick charts since it processes faster than a
> loop.
>  > > > > I have since converted over most of my loops for detecting patterns
>  > > > to this method for large explorations.
>  > > > > No Advanced Get is needed to replicate what is shown in the video.
>  > > > >
>  > > > > David K.
>  > > > >
>  > > > > percent=1;
>  > > > > r = H; s = L;
>  > > > > pR=PeakBars(r,percent,1)==0;
>  > > > > pS=TroughBars(s,percent,1)==0;
>  > > > >
>  > > > > xS0=SelectedValue(ValueWhen(pS,bi,1));
>  > > > > xS1=SelectedValue(ValueWhen(pS,bi,2));
>  > > > > xS2=SelectedValue(ValueWhen(pS,bi,3));
>  > > > > yS0=SelectedValue(ValueWhen(pS,s,1));
>  > > > > yS1=SelectedValue(ValueWhen(pS,s,2));
>  > > > > yS2=SelectedValue(ValueWhen(pS,s,3));
>  > > > > xR0=SelectedValue(ValueWhen(pR,bi,1));
>  > > > > xR1=SelectedValue(ValueWhen(pR,bi,2));
>  > > > > xR2=SelectedValue(ValueWhen(pR,bi,3));
>  > > > > yR0=SelectedValue(ValueWhen(pR,r,1));
>  > > > > yR1=SelectedValue(ValueWhen(pR,r,2));
>  > > > > yR2=SelectedValue(ValueWhen(pR,r,3));
>  > > > >
>  > > > > Now that the pivots have been identified create a "constant" 0% for
>  > > > > fib calculations - the following assigns the "D" letter as the last
>  > > > pivot (0%)
>  > > > >
>  > > > > if(xs0 >xr0==1)
>  > > > > {
>  > > > > Dy=ys0; Dx=xs0;
>  > > > > Cy=yr0; Cx=xr0;
>  > > > > By=ys1; Bx=xs1;
>  > > > > Ay=yr1; Ax=xr1;
>  > > > > Xy=ys2; Xx=xs2;
>  > > > > }
>  > > > > else
>  > > > > {
>  > > > > Dy=yr0;Dx=xr0;
>  > > > > Cy=ys0;Cx=xs0;
>  > > > > By=yr1;Bx=xr1;
>  > > > > Ay=ys1; Ax=xs1;
>  > > > > Xy=yr2; Xx=xr2;
>  > > > > }
>  > > > >
>  > > > > cd_delta=abs(dy-cy);
>  > > > > ab_delta=abs(ay-by); (this is the alternate swing described in
> the video)
>  > > > >
>  > > > > base=0; delta=0; plus=0;
>  > > > > procedure fvr(fib)
>  > > > > {
>  > > > > return IIf(plus,base+(delta*fib),base-(delta*fib));
>  > > > > }
>  > > > >
>  > > > > Create the CD retracement arrays
>  > > > > base=dy; plus=xs0>xr0; delta=cd_delta;
>  > > > > cd618=fvr(0.618); cd786=fvr(0.786);
>  > > > > cd127=fvr(1.270); cd162=fvr(1.618);
>  > > > > cd262=fvr(2.618);
>  > > > >
>  > > > >
>  > > > > Create the Alternate swing retracements
>  > > > > base=dy; plus=xs0>xr0; delta=ab_delta;
>  > > > > ap618=fvr(0.618); ap100=fvr(1.000);
>  > > > > ap127=fvr(1.270); ap162=fvr(1.618);
>  > > > >
>  > > > > --- In amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com>
>  > > > <mailto:amibroker%40yahoogroups.com>, reinsley <reinsley@> wrote:
>  > > > > >
>  > > > > >
>  > > > > > Carolyn's video looks like some AdvancedGet features...
>  > > > > >
>  > > > > > The following code may help you. The space between the red
> and blue
>  > > > line
>  > > > > > is the Brach zone.
>  > > > > >
>  > > > > > Best regards
>  > > > > >
>  > > > > >
>  > > > > > _SECTION_BEGIN( "Fibonacci" );
>  > > > > > Offset = 5; //use two sheets: one with 5 and another with 7,
> or maybe
>  > > > > > other offset value
>  > > > > > Avgmov = Offset * MA( abs( ROC( C, 1 ) ), 20 );
>  > > > > > //per = LastValue( Avgmov );//original value
>  > > > > > per = Param( "Pivot %", 0.3, 0.05, 6, 0.05 );
>  > > > > > x = Cum( 1 );
>  > > > > > Range = 0.01;
>  > > > > > PS = TroughBars( L, per, 1 ) == 0;
>  > > > > > xa = LastValue( ValueWhen( PS, x, 1 ) );//x from last trough
>  > > > > > Ya = LastValue( ValueWhen( PS, L, 1 ) );//y (Low) last trough
>  > > > > > PR = PeakBars( H, per, 1 ) == 0;
>  > > > > > xb = LastValue( ValueWhen( PR, x, 1 ) );//x from last peak
>  > > > > > Yb = LastValue( ValueWhen( PR, H, 1 ) );//y (High) last peak
>  > > > > > Trough_ReTest = abs( ( L / ya ) - 1 ) < Range;
>  > > > > > Peak_ReTest = abs( ( H / yb ) - 1 ) < Range;
>  > > > > > Trough_Cross = Cross( ya, C );
>  > > > > > Peak_Cross = Cross( C, yb );
>  > > > > >
>  > > > > > //UP = upSwing DN = downSwing
>  > > > > > UP = xb > xa;
>  > > > > > //upSwing
>  > > > > > DN = xa > xb;
>  > > > > > //DownSwing
>  > > > > >
>  > > > > >
>  > > > > > RT23_6 = IIf( UP, yb - ( yb - ya ) * 0.236, IIf( DN, ya + (
> yb - ya
>  > > > ) *
>  > > > > > 0.236, -1e10 ) );
>  > > > > >
>  > > > > > RT38_2 = IIf( UP, yb - ( yb - ya ) * 0.382, IIf( DN, ya + (
> yb - ya
>  > > > ) *
>  > > > > > 0.382, -1e10 ) );
>  > > > > >
>  > > > > > RT50_0 = IIf( UP, yb - ( yb - ya ) * 0.500, IIf( DN, ya + (
> yb - ya
>  > > > ) *
>  > > > > > 0.500, -1e10 ) );
>  > > > > >
>  > > > > > RT61_8 = IIf( UP, yb - ( yb - ya ) * 0.618, IIf( DN, ya + (
> yb - ya
>  > > > ) *
>  > > > > > 0.618, -1e10 ) );
>  > > > > >
>  > > > > > RT78_6 = IIf( UP, yb - ( yb - ya ) * 0.786, IIf( DN, ya + (
> yb - ya
>  > > > ) *
>  > > > > > 0.786, -1e10 ) );
>  > > > > >
>  > > > > > RT127_2 = IIf( UP, yb - ( yb - ya ) * 1.272, IIf( DN, ya + ( yb -
>  > > > ya ) *
>  > > > > > 1.272, -1e10 ) );
>  > > > > >
>  > > > > > RT161_8 = IIf( UP, yb - ( yb - ya ) * 1.618, IIf( DN, ya + ( yb -
>  > > > ya ) *
>  > > > > > 1.618, -1e10 ) );
>  > > > > >
>  > > > > > //RT261_8 = IIf( UP, yb - ( yb - ya ) * 2.618, IIf( DN, ya +
> ( yb -
>  > > > ya )
>  > > > > > * 2.618, -1e10 ) );
>  > > > > >
>  > > > > > RT = IIf( UP, -100 * ( yb - L ) / ( yb - ya ), 100 * ( H - ya
> ) / (
>  > > > yb -
>  > > > > > ya ) );//Retracement_Value
>  > > > > >
>  > > > > > InZone = C<yb & C>ya;
>  > > > > >
>  > > > > > Plot( IIf( x > xa, ya, -1e10 ), "", colorBrown, 1 + 8
> );//"Bottom"
>  > > > > > Plot( IIf( x > xb, yb, -1e10 ), "", colorBrown, 1 + 8 );//"Top"
>  > > > > >
>  > > > > > xab = IIf( xb > xa, xb, xa );
>  > > > > >
>  > > > > > //Retracements
>  > > > > >
>  > > > > > Plot( IIf( x >= xab + 1, RT23_6, -1e10 ), "", colorWhite, 1
> );//"23,6%
>  > > > > > Retr."
>  > > > > >
>  > > > > > Plot( IIf( x >= xab + 1, RT38_2, -1e10 ), "", colorGreen, 1
> );//"38,2%
>  > > > > > Retr."
>  > > > > >
>  > > > > > Plot( IIf( x >= xab + 1, RT50_0, -1e10 ), "", colorYellow, 1
>  > > > );//"50,0%
>  > > > > > Retr."
>  > > > > >
>  > > > > > Plot( IIf( x >= xab + 1, RT61_8, -1e10 ), "", colorRed, 1 + 8
>  > > > );//"61,8%
>  > > > > > Retr."
>  > > > > >
>  > > > > > Plot( IIf( x >= xab + 1, RT78_6, -1e10 ), "", colorBlue, 1 + 8
>  > > > > > );//"78,6% Retr."
>  > > > > >
>  > > > > > Plot( IIf( x >= xab + 1, RT127_2, -1e10 ), "", colorSkyblue, 1
>  > > > > > );//"127,2% Retr."
>  > > > > >
>  > > > > > Plot( IIf( x >= xab + 1, RT161_8, -1e10 ), "", colorLavender, 1
>  > > > > > );//"161,8% Retr."
>  > > > > >
>  > > > > > //Plot( IIf( x >= xab + 1, RT261_8, -1e10 ), "",
> colorDarkGreen, 1
>  > > > > > );//"261,8% Retr."
>  > > > > >
>  > > > > > //_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}}
> \nOpen %g
>  > > > > > \nHigh %g \nLow %g \nClose %g (%.1f%%) {{VALUES}}\n", O, H, L, C,
>  > > > > > SelectedValue( ROC( C, 1 ) ))
>  > > > > > //"per Fib = " + WriteVal(per, 1.1 ) + " \nCurrent Correction
> = " +
>  > > > > > WriteVal( RT, 1.0 ) + "%");
>  > > > > >
>  > > > > > _SECTION_END();
>  > > > > >
>  > > > > > _SECTION_BEGIN( "PrevSwing" );
>  > > > > > // previous swing resistance support
>  > > > > > Offsetps = 5; //use two sheets: one with 5 and another with 7, or
>  > > > maybe
>  > > > > > other offset value
>  > > > > > Avgmovps = Offsetps * MA( abs( ROC( C, 1 ) ), 20 );
>  > > > > > perps = Param( "PivotPS %", 0.3, 0.05, 10, 0.05 );
>  > > > > > xps = Cum( 1 );
>  > > > > > Rangeps = 0.01;
>  > > > > > PSps = TroughBars( L, perps, 1 ) == 0;
>  > > > > > xaps = LastValue( ValueWhen( PSps, x, 1 ) );//x from last trough
>  > > > > > Yaps = LastValue( ValueWhen( PSps, L, 1 ) );//y (Low) last trough
>  > > > > > PRps = PeakBars( H, perps, 1 ) == 0;
>  > > > > > xbps = LastValue( ValueWhen( PRps, x, 1 ) );//x from last peak
>  > > > > > Ybps = LastValue( ValueWhen( PRps, H, 1 ) );//y (High) last peak
>  > > > > > Trough_ReTestps = abs( ( L / yaps ) - 1 ) < Rangeps;
>  > > > > > Peak_ReTestps = abs( ( H / ybps ) - 1 ) < Rangeps;
>  > > > > > Trough_Crossps = Cross( yaps, C );
>  > > > > > Peak_Crossps = Cross( C, ybps );
>  > > > > >
>  > > > > > //UP = upSwing DN = downSwing
>  > > > > > UPps = xbps > xaps;
>  > > > > > //upSwing
>  > > > > > DNps = xaps > xbps;
>  > > > > > //DownSwing
>  > > > > >
>  > > > > >
>  > > > > > RT23_6ps = IIf( UPps, ybps - ( ybps - yaps ) * 0.236, IIf( DNps,
>  > > > yaps +
>  > > > > > ( ybps - yaps ) * 0.236, -1e10 ) );
>  > > > > >
>  > > > > > RT38_2ps = IIf( UPps, ybps - ( ybps - yaps ) * 0.382, IIf( DNps,
>  > > > yaps +
>  > > > > > ( ybps - yaps ) * 0.382, -1e10 ) );
>  > > > > >
>  > > > > > RT50_0ps = IIf( UPps, ybps - ( ybps - yaps ) * 0.500, IIf( DNps,
>  > > > yaps +
>  > > > > > ( ybps - yaps ) * 0.500, -1e10 ) );
>  > > > > >
>  > > > > > RT61_8ps = IIf( UPps, ybps - ( ybps - yaps ) * 0.618, IIf( DNps,
>  > > > yaps +
>  > > > > > ( ybps - yaps ) * 0.618, -1e10 ) );
>  > > > > >
>  > > > > > RT78_6ps = IIf( UPps, ybps - ( ybps - yaps ) * 0.786, IIf( DNps,
>  > > > yaps +
>  > > > > > ( ybps - yaps ) * 0.786, -1e10 ) );
>  > > > > >
>  > > > > > //RT127_2 = IIf( UP, yb - ( yb - ya ) * 1.272, IIf( DN, ya +
> ( yb -
>  > > > ya )
>  > > > > > * 1.272, -1e10 ) );
>  > > > > >
>  > > > > > //RT161_8 = IIf( UP, yb - ( yb - ya ) * 1.618, IIf( DN, ya +
> ( yb -
>  > > > ya )
>  > > > > > * 1.618, -1e10 ) );
>  > > > > >
>  > > > > > //RT261_8 = IIf( UP, yb - ( yb - ya ) * 2.618, IIf( DN, ya +
> ( yb -
>  > > > ya )
>  > > > > > * 2.618, -1e10 ) );
>  > > > > >
>  > > > > > //RT = IIf( UP, -100 * ( yb - L ) / ( yb - ya ), 100 * ( H -
> ya ) /
>  > > > ( yb
>  > > > > > - ya ) );//Retracement_Value
>  > > > > >
>  > > > > > InZoneps = C<ybps & C>yaps;
>  > > > > >
>  > > > > > Plot( IIf( xps > xaps, yaps, -1e10 ), "", colorGold, 1 + 8
> );//"Bottom"
>  > > > > > Plot( IIf( xps > xbps, ybps, -1e10 ), "", colorGold, 1 + 8
> );//"Top"
>  > > > > >
>  > > > > > xabps = IIf( xbps > xaps, xbps, xaps );
>  > > > > >
>  > > > > > //Retracements
>  > > > > >
>  > > > > > Plot( IIf( xps >= xabps + 1, RT23_6ps, -1e10 ), "", colorWhite,
>  > > > > > styleDashed );//"23,6% Retr."
>  > > > > >
>  > > > > > Plot( IIf( xps >= xabps + 1, RT38_2ps, -1e10 ), "", colorGreen,
>  > > > > > styleDashed );//"38,2% Retr."
>  > > > > >
>  > > > > > Plot( IIf( xps >= xabps + 1, RT50_0ps, -1e10 ), "", colorYellow,
>  > > > > > styleDashed );//"50,0% Retr."
>  > > > > >
>  > > > > > Plot( IIf( xps >= xabps + 1, RT61_8ps, -1e10 ), "", colorRed,
>  > > > > > styleDashed + 8 );//"61,8% Retr."
>  > > > > >
>  > > > > > Plot( IIf( xps >= xabps + 1, RT78_6ps, -1e10 ), "", colorBlue,
>  > > > > > styleDashed + 8 );//"78,6% Retr."
>  > > > > >
>  > > > > > //Plot( IIf( x >= xab + 1, RT127_2, -1e10 ), "", colorSkyblue, 1
>  > > > > > );//"127,2% Retr."
>  > > > > >
>  > > > > > //Plot( IIf( x >= xab + 1, RT161_8, -1e10 ), "", colorLavender, 1
>  > > > > > );//"161,8% Retr."
>  > > > > >
>  > > > > > //Plot( IIf( x >= xab + 1, RT261_8, -1e10 ), "",
> colorDarkGreen, 1
>  > > > > > );//"261,8% Retr."
>  > > > > >
>  > > > > > Title = StrFormat( "{{NAME}} - {{INTERVAL}} {{DATE}} \nOpen %g
>  > > > \nHigh %g
>  > > > > > \nLow %g \nClose %g (%.1f%%) {{VALUES}}\n", O, H, L, C,
> SelectedValue(
>  > > > > > ROC( C, 1 ) ) )
>  > > > > > + "per Fib = " + WriteVal( per, 1.1 ) + " \nCurrent Correction
>  > > > > > = " + WriteVal( RT, 1.0 ) + "%" + "\nper Fib prev= " + WriteVal(
>  > > > perps,
>  > > > > > 1.1 );
>  > > > > >
>  > > > > > _SECTION_END();
>  > > > > >
>  > > > > >
>  > > > > >
>  > > > > >
>  > > > > > Le 23/12/2009 19:46, kevinoversby a écrit :
>  > > > > > >
>  > > > > > >
>  > > > > > > Guys, stay tuned. I am overhauling this code based on:
>  > > > > > >
>  > > > > > > http://www.fibonacciqueen.com/public/885.cfm
> <http://www.fibonacciqueen.com/public/885.cfm>
>  > > > <http://www.fibonacciqueen.com/public/885.cfm
> <http://www.fibonacciqueen.com/public/885.cfm>>
>  > > > > > > <http://www.fibonacciqueen.com/public/885.cfm
> <http://www.fibonacciqueen.com/public/885.cfm>
>  > > > <http://www.fibonacciqueen.com/public/885.cfm
> <http://www.fibonacciqueen.com/public/885.cfm>>>
>  > > > > > >
>  > > > > > > Kevin
>  > > > > > >
>  > > > > > > --- In amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com>
>  > > > <mailto:amibroker%40yahoogroups.com>
> <mailto:amibroker%40yahoogroups.com>,
>  > > > > > > reinsley <reinsley@> wrote:
>  > > > > > > >
>  > > > > > > >
>  > > > > > > > Joris,
>  > > > > > > >
>  > > > > > > > Decrease to 500 does not solve anything.
>  > > > > > > >
>  > > > > > > >
>  > > > > > > > In the chart of the doubtful layout, I removed my two
> formulas.
>  > > > > > > > (5800 bars loaded)
>  > > > > > > > Then I loaded your formula, I get error 10 but I double click
>  > > > and the
>  > > > > > > > formula was displayed with a correct plot. Before it was not
>  > > > possible.
>  > > > > > > > Then I loaded my two formulas ( three formulas loaded, my
> two plus
>  > > > > > > > yours), everything was OK.
>  > > > > > > >
>  > > > > > > > But no way to reload your formula once more.
>  > > > > > > >
>  > > > > > > > Something goes wrong with my formulas plus yours.
>  > > > > > > >
>  > > > > > > > Best regards
>  > > > > > > >
>  > > > > > > >
>  > > > > > > > Le 23/12/2009 16:26, Joris M.schuller a écrit :
>  > > > > > > > >
>  > > > > > > > >
>  > > > > > > > > 1. So apparently it works in another layout. That’s
> something.
>  > > > > > > > >
>  > > > > > > > > 2. The minimum loaded bar number makes sense, since
> there is
>  > > > a plot
>  > > > > > > loop
>  > > > > > > > > of 900 iterations. For curiosity: change the loop to
> 500 and see
>  > > > > > > whether
>  > > > > > > > > you now only need 500 bars. That way there is confirmation.
>  > > > > > > > >
>  > > > > > > > > *From:* amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com>
>  > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > [mailto:amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com> <mailto:amibroker%40yahoogroups.com>
>  > > > > > > <mailto:amibroker%40yahoogroups.com>] *On
>  > > > > > > > > Behalf Of *reinsley
>  > > > > > > > > *Sent:* Wednesday, December 23, 2009 4:00 AM
>  > > > > > > > > *To:* amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com>
>  > > > <mailto:amibroker%40yahoogroups.com>
> <mailto:amibroker%40yahoogroups.com>
>  > > > > > > > > *Subject:* Re: [amibroker] Re: Writing a fib cluster
> indicator
>  > > > > > > > >
>  > > > > > > > >
>  > > > > > > > >
>  > > > > > > > > Hi Joris,
>  > > > > > > > >
>  > > > > > > > > Thank you for your comments.
>  > > > > > > > >
>  > > > > > > > > Into an another old layout, the old formula and the
> re-posted
>  > > > formula
>  > > > > > > > > work fine, both.
>  > > > > > > > > The minimum loaded bars is around 900. Below I get the
> error.
>  > > > > > > > > It is OK until 15' TU.
>  > > > > > > > >
>  > > > > > > > > Before to load the formula into the old layout (where
> it works) I
>  > > > > > > > > modified the blank spaces, I was into my doubtful
> layout/chart .
>  > > > > > > > > My blank bars right margin default value is set to 10.
>  > > > > > > > > I modified it to 1 then to 0, after AB reloading, blank
> space
>  > > > was ok
>  > > > > > > > > but error was sill there (in the suspicious layout).
>  > > > > > > > > It exist a recent built-in feature to adapt blank space
> with
>  > > > mouse or
>  > > > > > > > > keyboard, but I don't use it as I don't remember the trick.
>  > > > > > > > >
>  > > > > > > > > I got the same error at the same place in my default layout
>  > > > and 5700
>  > > > > > > > > bars loaded.
>  > > > > > > > >
>  > > > > > > > > array[100*i+10*j+k-111] = t[i] ...
>  > > > > > > > > ^
>  > > > > > > > > â•`
>  > > > > > > > >
>  > > > > > > > > I went into an old layout, formula ran well.
>  > > > > > > > >
>  > > > > > > > > After the successful attempt, I came back to my default
>  > > > layout (the
>  > > > > > > > > wrong one) and no way to load the formula.
>  > > > > > > > > I have 5700 bars loaded in 5' ( checked with CTRL H cross
>  > > > cursor).
>  > > > > > > > >
>  > > > > > > > > I checked the AFL in the main AB window, with floating
>  > > > windows, without
>  > > > > > > > > floating windows.
>  > > > > > > > >
>  > > > > > > > > No final clues, except that my others loaded formulas may
>  > > > create a
>  > > > > > > conflict.
>  > > > > > > > > There is no easy way to check which formulas are loaded
> into
>  > > > AB, I have
>  > > > > > > > > to do it manually and check the code.
>  > > > > > > > >
>  > > > > > > > > NB : A built-in feature that spit, towards txt files or
>  > > > excel, the
>  > > > > > > > > loaded fomulas related to layouts, charts and panes will be
>  > > > welcome...
>  > > > > > > > >
>  > > > > > > > > If the passerby named TJ read this Nota Bene ...
>  > > > > > > > >
>  > > > > > > > > Best regards
>  > > > > > > > >
>  > > > > > > > > Le 22/12/2009 23:08, Joris M.schuller a écrit :
>  > > > > > > > > >
>  > > > > > > > > >
>  > > > > > > > > > Reinsley,
>  > > > > > > > > >
>  > > > > > > > > > An additional point that I forgot to mention. I also
> checked
>  > > > > > > whether the
>  > > > > > > > > > out of range error you received was caused by selected
>  > > > blank bars
>  > > > > > > > > > setting, which in the past in some afl would give an
>  > > > out-of-range
>  > > > > > > error.
>  > > > > > > > > > (Tools/Preferences/blank bars). With and without
> blank bars,
>  > > > > > > everything
>  > > > > > > > > > works fine. So check whether the re-posted afl, which is
>  > > > the same
>  > > > > > > as the
>  > > > > > > > > > previous one, now does the trick. Good luck.
>  > > > > > > > > >
>  > > > > > > > > > *From:* amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com>
>  > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > [mailto:amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com>
>  > > > <mailto:amibroker%40yahoogroups.com>
> <mailto:amibroker%40yahoogroups.com>
>  > > > > > > > > <mailto:amibroker%40yahoogroups.com>] *On
>  > > > > > > > > > Behalf Of *Joris Schuller
>  > > > > > > > > > *Sent:* Tuesday, December 22, 2009 3:56 PM
>  > > > > > > > > > *To:* amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com>
>  > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > > > > *Subject:* RE: [amibroker] Re: Writing a fib cluster
> indicator
>  > > > > > > > > >
>  > > > > > > > > > Kevin,
>  > > > > > > > > >
>  > > > > > > > > > I understand that you had an error when displaying
> the afl.
>  > > > The afl I
>  > > > > > > > > > sent you works. Most of the time before I send out code,
>  > > > > > > including this
>  > > > > > > > > > time I first send the email from Outlook to one of my
>  > > > online accounts
>  > > > > > > > > > (e.g. gmail, hotmail). From there I copy the code
> back into
>  > > > the AB
>  > > > > > > > > > editor and verify that it displays properly. This
> morning I
>  > > > repeated
>  > > > > > > > > > that process again and had no problems. Below a copy
> of the
>  > > > original
>  > > > > > > > > > afl. See whether it 2^nd time around works.
>  > > > > > > > > >
>  > > > > > > > > > I looked a little bit more at your afl. I believe
> there are
>  > > > some
>  > > > > > > errors.
>  > > > > > > > > > In a couple of days I will send you some
> changes/additions
>  > > > which will
>  > > > > > > > > > facilitate localizing the problem.
>  > > > > > > > > >
>  > > > > > > > > > //===============Verify that afl below
> works===============
>  > > > > > > > > >
>  > > > > > > > > > //=========================Begin Original Fibonacci
>  > > > Levels-Original
>  > > > > > > > > > =====================================
>  > > > > > > > > > *Title* = EncodeColor(4)+ _DEFAULT_NAME()+";
> "+EncodeColor(1) +
>  > > > > > > > > > StrFormat("{{NAME}} - {{INTERVAL}}; {{DATE}}; O=%g, H=%g,
>  > > > L=%g, C=%g
>  > > > > > > > > > (%.1f%%)
>  > > > > > > > > > {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) );
>  > > > > > > > > > SetBarsRequired(*sbrAll*,*sbrAll*);
>  > > > > > > > > > //============== Begin Addition===================
>  > > > > > > > > > Plot(*C*,"C",1,64);
>  > > > > > > > > > ZigZagHL=ParamToggle("ZigZagHL","Off|On",1);
>  > > > > > > > > >
> NoOfLastPeaksTroughs=Param("NoOfLastPeaksTroughs",9,1,10,1);
>  > > > > > > > > >
> NoOfFibonacciLevels=Param("NoOfFibonacciLevels",9,1,10,1);
>  > > > > > > > > > Adjfactor=Param("Adjfactor",0.003,0,0.05,0.001); //Forex
>  > > > values;
>  > > > > > > > > > MinPlotValue=(1-Adjfactor)*LowestVisibleValue(*L*);
>  > > > > > > > > > MaxPlotValue=(1+Adjfactor)*HighestVisibleValue(*H*);
>  > > > > > > > > > Plot(MinPlotValue,"MinPlotValue",*colorGreen*,5);
>  > > > > > > > > > Plot(MaxPlotValue,"MaxPlotValue",4,5);
>  > > > > > > > > > //===============End Addition===========
>  > > > > > > > > > n = 0.3 ;//approx. 4 point swing on ES
>  > > > > > > > > > //fibs[1] = .62; fibs[2] = .27; fibs[3] = 0.01;
> fibs[4] = .38;
>  > > > > > > fibs[5] =
>  > > > > > > > > > .5;//added ?????????? fibs[3] = 0.01??;fibs[1]=fibs [6] =
>  > > > .62????????
>  > > > > > > > > > fibs[2] = .27;???????
>  > > > > > > > > > //fibs [6] = .62; fibs[7] = 1; fibs[8] = 1.27; fibs[9] =
>  > > > 1.62; //9
>  > > > > > > > > > symmetric levels//added????????(instead
>  > > > > > > > > > of:0,0.236,0.382,0.5,0.618,0.786.1,1.272)
>  > > > > > > > > > fibs[1] = 0.0; fibs[2] = .238; fibs[3] = .382; fibs[4] =
>  > > > .5;//added
>  > > > > > > > > > ?????????? fibs[3] = 0.01??;fibs[1]=fibs [6] =
> .62????????
>  > > > fibs[2] =
>  > > > > > > > > > .27;???????
>  > > > > > > > > > fibs [5] = .618; fibs[6] = 0.786;fibs[7] = 1; fibs[8]
> = 1.272;
>  > > > > > > fibs[9] =
>  > > > > > > > > > 1.618;//for(i=1;i<=9;i++) //Original
>  > > > > > > > > > *for*(i=1;i<=NoOfLastPeaksTroughs;i++)//Added
>  > > > > > > > > > {
>  > > > > > > > > > p[i] = LastValue(ValueWhen(PeakBars(*H*,n)==0,*H*,i));
>  > > > //last 9 peaks
>  > > > > > > > > > t[i] =
>  > > > LastValue(ValueWhen(TroughBars(*L*,n)==0,*L*,i));//last 9
>  > > > > > > troughs
>  > > > > > > > > > //for(j=1;j<=9;j++) //Original
>  > > > > > > > > > *for*(j=1;j<=NoOfLastPeaksTroughs;j++) //added
>  > > > > > > > > > {
>  > > > > > > > > > //for(k=1;k<=9;k++)
>  > > > > > > > > > *for*(k=1;k<=NoOfFibonacciLevels;k++) //added assumed
> that this
>  > > > > > > are the
>  > > > > > > > > > Fibonacct levels
>  > > > > > > > > > {
>  > > > > > > > > > array[100*i+10*j+k-111] = t[i] + fibs[k] * (p[j] - t[i]);
>  > > > // calc fib
>  > > > > > > > > > levels //added might have to adjust the
>  > > > constants(100,10,111) to
>  > > > > > > reflect
>  > > > > > > > > > the param values
>  > > > > > > > > > }}}
>  > > > > > > > > > // Plot levels for testing purposes
>  > > > > > > > > > *for*(i=1;i<=900;i++) {
>  > > > > > > > > > //Plot(IIf(array[i]>0,array[i],-1e10),"a",colorBlue);
>  > > > //Original
>  > > > > > > > > > Plot(IIf(array[i]>MinPlotValue *AND*
>  > > > > > > > > >
> array[i]<MaxPlotValue,array[i],-1e10),"a",*colorBlue*);//Added
>  > > > > > > > > > }
>  > > > > > > > > > //==============ZigZagHL=========================added
>  > > > > > > > > > *if* (ZigZagHL)
>  > > > > > > > > > {
>  > > > > > > > > > //added
>  > > > > > > > > > Plot( *C*, "Close", 1,64);
>  > > > > > > > > > zigpct = Param( "ZigHL %",0.2,0.01,10,0.01);
>  > > > > > > > > > ATRmult = Param("ATRmult",1.8,0.1,3,0.1);
>  > > > > > > > > > Arrowadj = Param("Arrowadj; ",12,2,25,1);
>  > > > > > > > > > HHLLSel = ParamToggle("Each Pk/Tr|HH/LL","Each
> Pk/Tr|HH/LL",1);
>  > > > > > > > > > pk=PeakBars(*H*,zigpct)==0;
>  > > > > > > > > > tr=TroughBars(*L*,zigpct)==0;
>  > > > > > > > > > zHi=Zig(*H*,zigpct); zLo=Zig(*L*,zigpct);
> HLAvg=(zHi+zLo)/2;
>  > > > > > > > > >
> zp=IIf(pk,zHi,IIf(tr,zLo,IIf(HLAvg>Ref(HLAvg,-1),*H*,*L*)));
>  > > > > > > > > > zag=Zig(zp,zigpct);
>  > > > > > > > > > pR=Ref(zag,-1)<zag *AND* zag>Ref(zag,1);
>  > > > > > > > > > pS=Ref(zag,-1)>zag *AND* zag<Ref(zag,1);
>  > > > > > > > > > Plot(*C*,"C",1,64);
>  > > > > > > > > > Plot(zag,"",11,1|*styleNoLabel*);//Zig H-L
>  > > > > > > > > >
> PlotShapes(*shapeDownArrow**pR,*colorGreen*,0,*H*,-Arrowadj);
>  > > > > > > > > > PlotShapes(*shapeUpArrow**pS,*colorRed*,0,*L*,-Arrowadj);
>  > > > > > > > > > *if*(HHLLSel)
>  > > > > > > > > > {
>  > > > > > > > > > HH=((zag>Ref(zag,- 1) *AND* zag > Ref(zag,1)) *AND*
>  > > > > > > (Peak(zag,zigpct,1
>  > > > > > > > > > )>Peak(zag,zigpct,2 ))); //HH
>  > > > > > > > > > LL=((zag<Ref(zag,- 1) *AND* zag < Ref(zag,1)) *AND*
>  > > > > > > (Trough(zag,zigpct,1
>  > > > > > > > > > ) <Trough(zag,zigpct,2 ))); //LL
>  > > > > > > > > > }
>  > > > > > > > > > *if*(!HHLLSel)
>  > > > > > > > > > {
>  > > > > > > > > > HH=((zag>Ref(zag,- 1) *AND* zag > Ref(zag,1)));
>  > > > > > > > > > LL=((zag<Ref(zag,- 1) *AND* zag < Ref(zag,1)));
>  > > > > > > > > > }
>  > > > > > > > > > dist = ATRmult*ATR (20);//might not want that
>  > > > > > > > > > *for*( i = 0; i < *BarCount*; i++ )
>  > > > > > > > > > {
>  > > > > > > > > > // ONLY THIS should be inside the loop
>  > > > > > > > > > *if*( HH [i]) PlotText( "HH"+ "\n"+*H*[ i ], i, *H*[ i
>  > > > ]+dist[i],
>  > > > > > > > > > *colorGreen* );
>  > > > > > > > > > *if*( LL [i] ) PlotText( ""+*L*[ i ]+"\nLL", i, *L*[ i
>  > > > ]-dist[i],
>  > > > > > > > > > *colorRed* );
>  > > > > > > > > > }
>  > > > > > > > > > }
>  > > > > > > > > > //=========================End Original Fibonacci
>  > > > Levels-Original
>  > > > > > > > > > =====================================
>  > > > > > > > > >
>  > > > > > > > > > *From:* amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com>
>  > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > [mailto:amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com>
>  > > > <mailto:amibroker%40yahoogroups.com>
> <mailto:amibroker%40yahoogroups.com>
>  > > > > > > > > <mailto:amibroker%40yahoogroups.com>] *On
>  > > > > > > > > > Behalf Of *kevinoversby
>  > > > > > > > > > *Sent:* Monday, December 21, 2009 3:35 PM
>  > > > > > > > > > *To:* amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com>
>  > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > > > > *Subject:* [amibroker] Re: Writing a fib cluster
> indicator
>  > > > > > > > > >
>  > > > > > > > > > Hi Joris,
>  > > > > > > > > >
>  > > > > > > > > > Thanks very much for your comments, I will work on it
> further
>  > > > > > > tonight.
>  > > > > > > > > > Regarding the levels, the first three were intended
> to be the
>  > > > > > > extensions
>  > > > > > > > > > -.62, -.27 & 0 but there was a problem at the time with
>  > > > negative
>  > > > > > > values
>  > > > > > > > > > (now solved). I agree .786 & .236 were missing.
>  > > > > > > > > >
>  > > > > > > > > > The idea behind adjusting the array indexing by 111
> was to
>  > > > start
>  > > > > > > at zero
>  > > > > > > > > > (when i=j=k=1, array index = 111 - 111) but this is not
>  > > > necessary, or
>  > > > > > > > > > could be fixed by starting i,j & k at zero.
>  > > > > > > > > >
>  > > > > > > > > > Kevin
>  > > > > > > > > >
>  > > > > > > > > > --- In amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com>
>  > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > > > <mailto:amibroker%40yahoogroups.com>,
>  > > > > > > > > > "Joris Schuller" <jschuller@> wrote:
>  > > > > > > > > > >
>  > > > > > > > > > > Don't know how experienced you are; with that in
> mind, I
>  > > > would
>  > > > > > > first
>  > > > > > > > > > > simplify code verification somewhat:
>  > > > > > > > > > >
>  > > > > > > > > > > 1. limit the plot to the current meaningful visible
>  > > > section by
>  > > > > > > using
>  > > > > > > > > > > MinPlotValue=(1-Adjfactor)*LowestVisibleValue(L) and
>  > > > > > > > > > > MaxPlotValue=(1+Adjfactor)*HighestVisibleValue(H);
>  > > > > > > > > > >
>  > > > > > > > > > > 2. start with and verify a simple case (1 pair of
> peaks and
>  > > > > > > > > troughs) and
>  > > > > > > > > > > expand from that. Compare results with the results
> using the
>  > > > > > > Fibonacci
>  > > > > > > > > > > toolbar
>  > > > > > > > > > >
>  > > > > > > > > > > 3. use params to be able to methodically build up in
>  > > > complexity
>  > > > > > > > > > >
>  > > > > > > > > > > 4. turn on/off the included ZigZagHL to verify that the
>  > > > correct
>  > > > > > > > > > > peaks/troughs are selected
>  > > > > > > > > > >
>  > > > > > > > > > > 5. verify that the (incorrect) Fib levels you selected
>  > > > are what you
>  > > > > > > > > want
>  > > > > > > > > > >
>  > > > > > > > > > > 6. convert the constants in the Fib level loop
>  > > > (10,100,111) to
>  > > > > > > params
>  > > > > > > > > > > (currently incorrect Fib values are displayed).
>  > > > > > > > > > >
>  > > > > > > > > > > 7. changes are prefaced by "added"
>  > > > > > > > > > >
>  > > > > > > > > > >
>  > > > > > > > > > >
>  > > > > > > > > > > The proposed changes are shown below.
>  > > > > > > > > > >
>  > > > > > > > > > >
>  > > > > > > > > > >
>  > > > > > > > > > > Title = EncodeColor(4)+ _DEFAULT_NAME()+";
> "+EncodeColor(1) +
>  > > > > > > > > > > StrFormat("{{NAME}} - {{INTERVAL}}; {{DATE}}; O=%g,
> H=%g,
>  > > > L=%g,
>  > > > > > > C=%g
>  > > > > > > > > > > (%.1f%%)
>  > > > > > > > > > > {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )
> ) );
>  > > > > > > > > > > SetBarsRequired(sbrAll,sbrAll);
>  > > > > > > > > > > //============== added; Begin First
>  > > > Addition===================
>  > > > > > > > > > > Plot(C,"C",1,64);
>  > > > > > > > > > > ZigZagHL=ParamToggle("ZigZagHL","Off|On",1);
>  > > > > > > > > > >
> NoOfLastPeaksTroughs=Param("NoOfLastPeaksTroughs",9,1,10,1);
>  > > > > > > > > > >
> NoOfFibonacciLevels=Param("NoOfFibonacciLevels",9,1,10,1);
>  > > > > > > > > > > Adjfactor=Param("Adjfactor",0.003,0,0.05,0.001);
> //added.
>  > > > Forex
>  > > > > > > > > > values; for
>  > > > > > > > > > > stocks use change as necessary
>  > > > > > > > > > > MinPlotValue=(1-Adjfactor)*LowestVisibleValue(L);
>  > > > > > > > > > > MaxPlotValue=(1+Adjfactor)*HighestVisibleValue(H);
>  > > > > > > > > > > Plot(MinPlotValue,"MinPlotValue",colorGreen,5);
>  > > > > > > > > > > Plot(MaxPlotValue,"MaxPlotValue",4,5);
>  > > > > > > > > > > //===============End First Addition===========
>  > > > > > > > > > > n = 0.3 ;//approx. 4 point swing on ES
>  > > > > > > > > > > //fibs[1] = .62; fibs[2] = .27; fibs[3] = 0.01;
> fibs[4] =
>  > > > .38;
>  > > > > > > > > fibs[5] =
>  > > > > > > > > > > .5;//added ?????????? fibs[3] = 0.01??;fibs[1]=fibs
> [6] =
>  > > > > > > .62????????
>  > > > > > > > > > > fibs[2] = .27;???????
>  > > > > > > > > > > //fibs [6] = .62; fibs[7] = 1; fibs[8] = 1.27;
> fibs[9] =
>  > > > 1.62; //9
>  > > > > > > > > > symmetric
>  > > > > > > > > > > levels//added????????(instead
>  > > > > > > of:0,0.236,0.382,0.5,0.618,0.786.1,1.272)
>  > > > > > > > > > > fibs[1] = 0.0; fibs[2] = .238; fibs[3] = .382;
> fibs[4] =
>  > > > .5;//added
>  > > > > > > > > > > ?????????? fibs[3] = 0.01??;fibs[1]=fibs [6] =
> .62????????
>  > > > > > > fibs[2] =
>  > > > > > > > > > > .27;???????
>  > > > > > > > > > > fibs [5] = .618; fibs[6] = 0.786;fibs[7] = 1; fibs[8] =
>  > > > 1.272;
>  > > > > > > > > fibs[9] =
>  > > > > > > > > > > 1.618;//for(i=1;i<=9;i++) //Original
>  > > > > > > > > > > for(i=1;i<=NoOfLastPeaksTroughs;i++)//Added
>  > > > > > > > > > > {
>  > > > > > > > > > > p[i] = LastValue(ValueWhen(PeakBars(H,n)==0,H,i));
> //last
>  > > > 9 peaks
>  > > > > > > > > > > t[i] =
> LastValue(ValueWhen(TroughBars(L,n)==0,L,i));//last 9
>  > > > > > > troughs
>  > > > > > > > > > >
>  > > > > > > > > > > //for(j=1;j<=9;j++) //Original
>  > > > > > > > > > > for(j=1;j<=NoOfLastPeaksTroughs;j++) //added
>  > > > > > > > > > > {
>  > > > > > > > > > > //for(k=1;k<=9;k++)
>  > > > > > > > > > > for(k=1;k<=NoOfFibonacciLevels;k++) //added;
> assumed that
>  > > > this
>  > > > > > > are the
>  > > > > > > > > > > Fibonacci levels
>  > > > > > > > > > > {
>  > > > > > > > > > > array[100*i+10*j+k-111] = t[i] + fibs[k] * (p[j] -
> t[i]); //
>  > > > > > > calc fib
>  > > > > > > > > > levels
>  > > > > > > > > > > //added; might have to adjust the
> constants(100,10,111) to
>  > > > > > > reflect the
>  > > > > > > > > > > param values
>  > > > > > > > > > > }}}
>  > > > > > > > > > > // Plot levels for testing purposes
>  > > > > > > > > > > for(i=1;i<=900;i++) {
>  > > > > > > > > > > //Plot(IIf(array[i]>0,array[i],-1e10),"a",colorBlue);
>  > > > //Original
>  > > > > > > > > > > Plot(IIf(array[i]>MinPlotValue AND
>  > > > > > > > > > >
> array[i]<MaxPlotValue,array[i],-1e10),"a",colorBlue);//Added
>  > > > > > > > > > > }
>  > > > > > > > > > >
>  > > > > > > > > > > //==============ZigZagHL; added for verification
>  > > > > > > > > > > purposes=========================
>  > > > > > > > > > > if (ZigZagHL)
>  > > > > > > > > > > {
>  > > > > > > > > > > //added
>  > > > > > > > > > > Plot( C, "Close", 1,64);
>  > > > > > > > > > > zigpct = Param( "Zag %",0.2,0.01,10,0.01);
>  > > > > > > > > > > ATRmult = Param("ATRmult",1.8,0.1,3,0.1);
>  > > > > > > > > > > Arrowadj = Param("Arrowadj; ",12,2,25,1);
>  > > > > > > > > > > HHLLSel = ParamToggle("Each Pk/Tr|HH/LL","Each
>  > > > Pk/Tr|HH/LL",1);
>  > > > > > > > > > > pk=PeakBars(H,zigpct)==0;
>  > > > > > > > > > > tr=TroughBars(L,zigpct)==0;
>  > > > > > > > > > > zHi=Zig(H,zigpct); zLo=Zig(L,zigpct);
> HLAvg=(zHi+zLo)/2;
>  > > > > > > > > > >
> zp=IIf(pk,zHi,IIf(tr,zLo,IIf(HLAvg>Ref(HLAvg,-1),H,L)));
>  > > > > > > > > > > zag=Zig(zp,zigpct);
>  > > > > > > > > > > pR=Ref(zag,-1)<zag AND zag>Ref(zag,1);
>  > > > > > > > > > > pS=Ref(zag,-1)>zag AND zag<Ref(zag,1);
>  > > > > > > > > > > Plot(C,"C",1,64);
>  > > > > > > > > > > Plot(zag,"",11,1|styleNoLabel);//Zig H-L
>  > > > > > > > > > > PlotShapes(shapeDownArrow*pR,colorGreen,0,H,-Arrowadj);
>  > > > > > > > > > > PlotShapes(shapeUpArrow*pS,colorRed,0,L,-Arrowadj);
>  > > > > > > > > > > if(HHLLSel)
>  > > > > > > > > > > {
>  > > > > > > > > > > HH=((zag>Ref(zag,- 1) AND zag > Ref(zag,1)) AND
>  > > > (Peak(zag,zigpct,1
>  > > > > > > > > > > )>Peak(zag,zigpct,2 ))); //HH
>  > > > > > > > > > > LL=((zag<Ref(zag,- 1) AND zag < Ref(zag,1)) AND
>  > > > > > > (Trough(zag,zigpct,1 )
>  > > > > > > > > > > <Trough(zag,zigpct,2 ))); //LL
>  > > > > > > > > > > }
>  > > > > > > > > > > if(!HHLLSel)
>  > > > > > > > > > > {
>  > > > > > > > > > > HH=((zag>Ref(zag,- 1) AND zag > Ref(zag,1)));
>  > > > > > > > > > > LL=((zag<Ref(zag,- 1) AND zag < Ref(zag,1)));
>  > > > > > > > > > > }
>  > > > > > > > > > > dist = ATRmult*ATR (20);//might not want that
>  > > > > > > > > > > for( i = 0; i < BarCount; i++ )
>  > > > > > > > > > > {
>  > > > > > > > > > > // ONLY THIS should be inside the loop
>  > > > > > > > > > > if( HH [i]) PlotText( "HH"+ "\n"+H[ i ], i, H[ i
> ]+dist[i],
>  > > > > > > > > > colorGreen );
>  > > > > > > > > > > if( LL [i] ) PlotText( ""+L[ i ]+"\nLL", i, L[ i
> ]-dist[i],
>  > > > > > > colorRed );
>  > > > > > > > > > > }
>  > > > > > > > > > > }
>  > > > > > > > > > >
>  > > > > > > > > > >
>  > > > > > > > > > >
>  > > > > > > > > > > From: amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com>
>  > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > > > > [mailto:amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com>
>  > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > <mailto:amibroker%40yahoogroups.com>]
>  > > > > > > > > > On Behalf
>  > > > > > > > > > > Of kevinoversby
>  > > > > > > > > > > Sent: Saturday, December 19, 2009 4:32 PM
>  > > > > > > > > > > To: amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com>
>  > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > > > > > Subject: [amibroker] Re: Writing a fib cluster
> indicator
>  > > > > > > > > > >
>  > > > > > > > > > >
>  > > > > > > > > > >
>  > > > > > > > > > >
>  > > > > > > > > > >
>  > > > > > > > > > >
>  > > > > > > > > > >
>  > > > > > > > > > >
>  > > > > > > > > >
>  > > > > > > > >
>  > > > > > >
>  > > >
> http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004>
>  > > >
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004>>
>  > > > > > >
>  > > >
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004>
>  > > >
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004>>>
>  > > > > > > > >
>  > > > > > >
>  > > >
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004>
>  > > >
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004>>
>  > > > > > >
>  > > >
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004>
>  > > >
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004>>>>
>  > > > > > > > > >
>  > > > > > > > >
>  > > > > > >
>  > > >
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004>
>  > > >
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004>>
>  > > > > > >
>  > > >
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004>
>  > > >
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004>>>
>  > > > > > > > >
>  > > > > > >
>  > > >
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004>
>  > > >
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004>>
>  > > > > > >
>  > > >
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004>
>  > > >
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004
> <http://groups.yahoo.com/group/amibroker/photos/album/1601688415/pic/10192004>>>>>
>  > > > > > > > > > > 79/view
>  > > > > > > > > > >
>  > > > > > > > > > > See link for plot of unfiltered levels. Levels will be
>  > > > filtered by
>  > > > > > > > > > proximity
>  > > > > > > > > > > and could also be weighted, for example, by size of
> swing
>  > > > producing
>  > > > > > > > > them.
>  > > > > > > > > > >
>  > > > > > > > > > > Constructive comments welcome and appreciated.
>  > > > > > > > > > >
>  > > > > > > > > > > --- In amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com>
>  > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > > > > <mailto:amibroker%40yahoogroups.com> ,
>  > > > > > > > > > > "kevinoversby" <kevinoversby@> wrote:
>  > > > > > > > > > > >
>  > > > > > > > > > > >
>  > > > > > > > > > > >
>  > > > > > > > > > > > OK, its running stably now, execution time well under
>  > > > 0.5 s. Next
>  > > > > > > > > steps
>  > > > > > > > > > > are to sort the levels and detect clusters for
> plotting.
>  > > > > > > > > > > >
>  > > > > > > > > > > > If I try to set any of the fibs values to
> negative values
>  > > > > > > they are
>  > > > > > > > > > > returned as {EMPTY} - why is that?
>  > > > > > > > > > > >
>  > > > > > > > > > > > Thanks / Kevin
>  > > > > > > > > > > >
>  > > > > > > > > > > > SetBarsRequired(sbrAll,sbrAll);
>  > > > > > > > > > > >
>  > > > > > > > > > > > n = 0.3 ;//approx. 4 point swing on ES
>  > > > > > > > > > > > fibs[1] = .62; fibs[2] = .27; fibs[3] = 0.01;
> fibs[4] =
>  > > > .38;
>  > > > > > > > > > fibs[5] = .5;
>  > > > > > > > > > > > fibs [6] = .62; fibs[7] = 1; fibs[8] = 1.27;
> fibs[9] =
>  > > > 1.62; //9
>  > > > > > > > > > symmetric
>  > > > > > > > > > > levels
>  > > > > > > > > > > >
>  > > > > > > > > > > > for(i=1;i<=9;i++)
>  > > > > > > > > > > > {
>  > > > > > > > > > > >
>  > > > > > > > > > > > p[i] = LastValue(ValueWhen(PeakBars(H,n)==0,H,i));
>  > > > //last 9 peaks
>  > > > > > > > > > > > t[i] =
>  > > > LastValue(ValueWhen(TroughBars(L,n)==0,L,i));//last 9
>  > > > > > > troughs
>  > > > > > > > > > > >
>  > > > > > > > > > > > for(j=1;j<=9;j++)
>  > > > > > > > > > > > {
>  > > > > > > > > > > > for(k=1;k<=9;k++)
>  > > > > > > > > > > > {
>  > > > > > > > > > > >
>  > > > > > > > > > > > array[100*i+10*j+k-111] = t[i] + fibs[k] * (p[j] -
>  > > > t[i]); //
>  > > > > > > calc fib
>  > > > > > > > > > > levels
>  > > > > > > > > > > > }}}
>  > > > > > > > > > > >
>  > > > > > > > > > > > // Plot levels for testing purposes
>  > > > > > > > > > > >
>  > > > > > > > > > > > for(i=1;i<=900;i++) {
>  > > > > > > > > > > > Plot(IIf(array[i]>0,array[i],-1e10),"a",colorBlue);
>  > > > > > > > > > > > }
>  > > > > > > > > > > >
>  > > > > > > > > > > >
>  > > > > > > > > > > >
>  > > > > > > > > > > > --- In amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com>
>  > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > > > <mailto:amibroker%40yahoogroups.com> ,
>  > > > > > > > > > > "kevinoversby" <kevinoversby@> wrote:
>  > > > > > > > > > > > >
>  > > > > > > > > > > > >
>  > > > > > > > > > > > >
>  > > > > > > > > > > > >
>  > > > > > > > > > > > >
>  > > > > > > > > > > > >
>  > > > > > > > > > > > > I've now got the levels plotting on ES 15
> second data
>  > > > and its
>  > > > > > > > > > actually
>  > > > > > > > > > > quite fast as the array function calls are in a small
>  > > > loop. The
>  > > > > > > > > > strange part
>  > > > > > > > > > > is that the array reverts to empty shortly after
>  > > > plotting. Can
>  > > > > > > > > anyone see
>  > > > > > > > > > > why?
>  > > > > > > > > > > > >
>  > > > > > > > > > > > > Thanks / Kevin
>  > > > > > > > > > > > >
>  > > > > > > > > > > > >
>  > > > > > > > > > > > > n = 0.3 ; //approx. 4 point swing on ES
>  > > > > > > > > > > > > fibs[1] = -.62; fibs[2] = -.27; fibs[3] = 0;
> fibs[4]
>  > > > = .38;
>  > > > > > > > > fibs[5] =
>  > > > > > > > > > > .5;
>  > > > > > > > > > > > > fibs [6] = .62; fibs[7] = 1; fibs[8] = 1.27;
> fibs[9] =
>  > > > > > > 1.62; //9
>  > > > > > > > > > > symmetric levels
>  > > > > > > > > > > > >
>  > > > > > > > > > > > > PeakCondition=PeakBars(H,n)==0;
>  > > > > > > > > > > > > TroughCondition=TroughBars(L,n)==0;
>  > > > > > > > > > > > >
>  > > > > > > > > > > > > for(i=1;i<=10;i++)
>  > > > > > > > > > > > > {
>  > > > > > > > > > > > >
>  > > > > > > > > > > > > p[i]=LastValue(ValueWhen(PeakCondition,H,i));
>  > > > > > > > > > > > > t[i] = LastValue(ValueWhen(TroughCondition,L,i));
>  > > > > > > > > > > > >
>  > > > > > > > > > > > > for(j=1;j<=10;j++)
>  > > > > > > > > > > > > {
>  > > > > > > > > > > > > for(k=1;k<=5;k++)
>  > > > > > > > > > > > > {
>  > > > > > > > > > > > >
>  > > > > > > > > > > > > array[i+j+k-2] = t[i] + fibs[k] * (p[j] -
> t[i]); // calc
>  > > > > > > fib levels
>  > > > > > > > > > > > > }}}
>  > > > > > > > > > > > >
>  > > > > > > > > > > > > // Plot first 100 unfiltered levels for test
> purposes
>  > > > > > > > > > > > >
>  > > > > > > > > > > > > for(i=1;i<=100;i++) {
>  > > > > > > > > > > > > Plot(IIf(array[i]>0,array[i],-1e10),"a",colorBlue);
>  > > > > > > > > > > > > }
>  > > > > > > > > > > > >
>  > > > > > > > > > > > > --- In amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com>
>  > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > > > <mailto:amibroker%40yahoogroups.com> ,
>  > > > > > > > > > > "kevinoversby" <kevinoversby@> wrote:
>  > > > > > > > > > > > > >
>  > > > > > > > > > > > > > Hi Mike,
>  > > > > > > > > > > > > >
>  > > > > > > > > > > > > > Thank you very much for taking the time to post
>  > > > these tips. I
>  > > > > > > > > will
>  > > > > > > > > > > incorporate as much as I can and post the update later.
>  > > > > > > > > > > > > >
>  > > > > > > > > > > > > >
>  > > > > > > > > > > > > > Kevin
>  > > > > > > > > > > > > >
>  > > > > > > > > > > > > > --- In amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com>
>  > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > > > > > , "Mike" <sfclimbers@> wrote:
>  > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > Hi,
>  > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > A couple of quick points to spare you some
> wasted
>  > > > time.
>  > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > 1. In general; I think that you would benifet
>  > > > greatly by
>  > > > > > > > > > reading the
>  > > > > > > > > > > following:
>  > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > >
>  > > > http://www.amibroker.com/guide/h_understandafl.html
> <http://www.amibroker.com/guide/h_understandafl.html>
>  > > > <http://www.amibroker.com/guide/h_understandafl.html
> <http://www.amibroker.com/guide/h_understandafl.html>>
>  > > > > > > <http://www.amibroker.com/guide/h_understandafl.html
> <http://www.amibroker.com/guide/h_understandafl.html>
>  > > > <http://www.amibroker.com/guide/h_understandafl.html
> <http://www.amibroker.com/guide/h_understandafl.html>>>
>  > > > > > > > > <http://www.amibroker.com/guide/h_understandafl.html
> <http://www.amibroker.com/guide/h_understandafl.html>
>  > > > <http://www.amibroker.com/guide/h_understandafl.html
> <http://www.amibroker.com/guide/h_understandafl.html>>
>  > > > > > > <http://www.amibroker.com/guide/h_understandafl.html
> <http://www.amibroker.com/guide/h_understandafl.html>
>  > > > <http://www.amibroker.com/guide/h_understandafl.html
> <http://www.amibroker.com/guide/h_understandafl.html>>>>
>  > > > > > > > > > <http://www.amibroker.com/guide/h_understandafl.html
> <http://www.amibroker.com/guide/h_understandafl.html>
>  > > > <http://www.amibroker.com/guide/h_understandafl.html
> <http://www.amibroker.com/guide/h_understandafl.html>>
>  > > > > > > <http://www.amibroker.com/guide/h_understandafl.html
> <http://www.amibroker.com/guide/h_understandafl.html>
>  > > > <http://www.amibroker.com/guide/h_understandafl.html
> <http://www.amibroker.com/guide/h_understandafl.html>>>
>  > > > > > > > > <http://www.amibroker.com/guide/h_understandafl.html
> <http://www.amibroker.com/guide/h_understandafl.html>
>  > > > <http://www.amibroker.com/guide/h_understandafl.html
> <http://www.amibroker.com/guide/h_understandafl.html>>
>  > > > > > > <http://www.amibroker.com/guide/h_understandafl.html
> <http://www.amibroker.com/guide/h_understandafl.html>
>  > > > <http://www.amibroker.com/guide/h_understandafl.html
> <http://www.amibroker.com/guide/h_understandafl.html>>>>>
>  > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > 2. You *really* do not want to be making
> array based
>  > > > > > > function
>  > > > > > > > > > calls
>  > > > > > > > > > > (e.g. PeakBars, ValueWhen, IIF, TroughBars, etc)
> within a
>  > > > loop.
>  > > > > > > This
>  > > > > > > > > > will be
>  > > > > > > > > > > horribly slow. Look for a way to calculate everything
>  > > > outside of a
>  > > > > > > > > loop.
>  > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > 3. The termination check of all your for
> loops are
>  > > > > > > incorrect.
>  > > > > > > > > > Do not
>  > > > > > > > > > > use "i = 10". You probably want something like "i
> <= 10". It
>  > > > > > > needs to
>  > > > > > > > > > be a
>  > > > > > > > > > > boolean if you ever want it to terminate. Also "=" is
>  > > > assignment,
>  > > > > > > > > "==" is
>  > > > > > > > > > > equivalence test.
>  > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > >
> http://www.amibroker.com/guide/a_mistakes.html
> <http://www.amibroker.com/guide/a_mistakes.html>
>  > > > <http://www.amibroker.com/guide/a_mistakes.html
> <http://www.amibroker.com/guide/a_mistakes.html>>
>  > > > > > > <http://www.amibroker.com/guide/a_mistakes.html
> <http://www.amibroker.com/guide/a_mistakes.html>
>  > > > <http://www.amibroker.com/guide/a_mistakes.html
> <http://www.amibroker.com/guide/a_mistakes.html>>>
>  > > > > > > > > <http://www.amibroker.com/guide/a_mistakes.html
> <http://www.amibroker.com/guide/a_mistakes.html>
>  > > > <http://www.amibroker.com/guide/a_mistakes.html
> <http://www.amibroker.com/guide/a_mistakes.html>>
>  > > > > > > <http://www.amibroker.com/guide/a_mistakes.html
> <http://www.amibroker.com/guide/a_mistakes.html>
>  > > > <http://www.amibroker.com/guide/a_mistakes.html
> <http://www.amibroker.com/guide/a_mistakes.html>>>>
>  > > > > > > > > > <http://www.amibroker.com/guide/a_mistakes.html
> <http://www.amibroker.com/guide/a_mistakes.html>
>  > > > <http://www.amibroker.com/guide/a_mistakes.html
> <http://www.amibroker.com/guide/a_mistakes.html>>
>  > > > > > > <http://www.amibroker.com/guide/a_mistakes.html
> <http://www.amibroker.com/guide/a_mistakes.html>
>  > > > <http://www.amibroker.com/guide/a_mistakes.html
> <http://www.amibroker.com/guide/a_mistakes.html>>>
>  > > > > > > > > <http://www.amibroker.com/guide/a_mistakes.html
> <http://www.amibroker.com/guide/a_mistakes.html>
>  > > > <http://www.amibroker.com/guide/a_mistakes.html
> <http://www.amibroker.com/guide/a_mistakes.html>>
>  > > > > > > <http://www.amibroker.com/guide/a_mistakes.html
> <http://www.amibroker.com/guide/a_mistakes.html>
>  > > > <http://www.amibroker.com/guide/a_mistakes.html
> <http://www.amibroker.com/guide/a_mistakes.html>>>>>
>  > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > 4. When trying to populate an array inside a
>  > > > loop, you
>  > > > > > > > > generally
>  > > > > > > > > > > should be populating bar by bar: e.g. array[i] = ...
>  > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > Mike
>  > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > --- In amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com>
>  > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > > > > > <mailto:amibroker%40yahoogroups.com> , "kevinoversby"
>  > > > > > > <kevinoversby@>
>  > > > > > > > > > wrote:
>  > > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > > Parts 1) & 2)
>  > > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > > n = 0.3 //approx. 4 point swing on ES
>  > > > > > > > > > > > > > > > fibs = [-.62 -.27 0 .38 .5 .62 1 1.27 1.62];
>  > > > //symmetric
>  > > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > > for(i=1;i=10;i++)
>  > > > > > > > > > > > > > > > {
>  > > > > > > > > > > > > > > > PeakCondition=PeakBars(H,n)==0;
>  > > > > > > > > > > > > > > > p[i] = ValueWhen(PeakCondition,H,i);
>  > > > > > > > > > > > > > > > p[i] = IIf(p[i] >= HHV(p,i),p[i],0); //set to
>  > > > zero if
>  > > > > > > not HH
>  > > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > > TroughCondition=TroughBars(L,n)==0;
>  > > > > > > > > > > > > > > > t[i] = ValueWhen(TroughCondition,L,i);
>  > > > > > > > > > > > > > > > t[i] = IIf(t[i] <= LLV(t,i),t[i],0); //set to
>  > > > zero if
>  > > > > > > not LL
>  > > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > > for(j=1;j=10;j++)
>  > > > > > > > > > > > > > > > {
>  > > > > > > > > > > > > > > > for(k=1;k=9;k++)
>  > > > > > > > > > > > > > > > {
>  > > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > > array = t[i] + fibs[k] * (p[j] - t[i]);
> // calc fib
>  > > > > > > levels
>  > > > > > > > > > > > > > > > }}}
>  > > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > > I'm unsure of the last line - how to
> assign the fib
>  > > > > > > levels
>  > > > > > > > > > to an
>  > > > > > > > > > > array for sorting. Thanks in advance for any help.
>  > > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > > Kevin
>  > > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > > --- In amibroker@xxxxxxxxxxxxxxx
> <mailto:amibroker%40yahoogroups.com>
>  > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > > > > <mailto:amibroker%40yahoogroups.com>
>  > > > > > > > > > > <mailto:amibroker%40yahoogroups.com> , "kevinoversby"
>  > > > > > > <kevinoversby@>
>  > > > > > > > > > wrote:
>  > > > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > > > I have not found an AFL implementation
> of this so
>  > > > > > > > > decided to
>  > > > > > > > > > > develop my own. I'm doing it here as there are a couple
>  > > > of coding
>  > > > > > > > > > issues I'm
>  > > > > > > > > > > unsure of. Constructive comments and tips most welcome.
>  > > > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > > > Process:
>  > > > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > > > 1) Find i last higher peaks and j last
> lower
>  > > > troughs
>  > > > > > > > > > > > > > > > > 2) For each peak/trough pair, calculate fib
>  > > > levels and
>  > > > > > > > > add to
>  > > > > > > > > > > array
>  > > > > > > > > > > > > > > > > 3) Sort array
>  > > > > > > > > > > > > > > > > 4) Discard a level if distance to next
> level >
>  > > > > > > tolerance
>  > > > > > > > > > > > > > > > > 5) Plot remaining levels, preferably at
> left
>  > > > or right
>  > > > > > > > > > edge like
>  > > > > > > > > > > volume at price (VAP) to simplify chart.
>  > > > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > > > (A thought just occurred that this
> would also
>  > > > be a
>  > > > > > > useful
>  > > > > > > > > > > exercise with VAP levels - investigate later).
>  > > > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > > > Kevin
>  > > > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > > >
>  > > > > > > > > > > > > > >
>  > > > > > > > > > > > > >
>  > > > > > > > > > > > >
>  > > > > > > > > > > >
>  > > > > > > > > > >
>  > > > > > > > > >
>  > > > > > > > > >
>  > > > > > > > >
>  > > > > > > > > --
>  > > > > > > > > Best regards
>  > > > > > > > >
>  > > > > > > > >
>  > > > > > > >
>  > > > > > > >
>  > > > > > > > --
>  > > > > > > > Best regards
>  > > > > > > >
>  > > > > > >
>  > > > > > >
>  > > > > >
>  > > > > >
>  > > > > > --
>  > > > > > Best regards
>  > > > > >
>  > > > >
>  > > >
>  > > >
>  > >
>  > >
>  > > --
>  > > Best regards
>  > >
>  >
>
>


--
Best regards


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

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

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

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:
    amibroker-digest@xxxxxxxxxxxxxxx
    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/


__._,_.___


**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

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





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___