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

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


  • Date: Sun, 27 Dec 2009 12:53:06 +0100
  • From: reinsley <reinsley@xxxxxxxx>
  • Subject: Re: [amibroker] Re: Writing a fib cluster indicator

PureBytes Links

Trading Reference Links

and for the next step...

UpZig = IIf( LastValue( z, 1 ) >= Ref( z, -piv ), 1, 0 );
_TRACE( "UpZig= " + UpZig );


BR

Le 27/12/2009 12:46, reinsley a écrit :
>
>
> Lx = fvb;
> Hx = Lvb; // can't get bar index to work for Ly&  Hy
>
> Are you looking for that ?
>
> P = ParamField( "Price field" );
> change = Param("% change",0.3,0.1,9,0.1);
> z = Zig(P, change);
> Plot( z, _DEFAULT_NAME(), ParamColor( "Color", colorYellow ),
> ParamStyle("Style") );
>
> pivvalue=LowestSince( Ref(z,1)>  z AND Ref(z,-1)>  z, z, 1 ) ;
> piv=LowestSinceBars( Ref(z,1)>  z AND Ref(z,-1)>  z, z, 1 ) ;// base 0
> _TRACE("pivvalue = "+pivvalue);
> _TRACE("piv = "+piv);
>
> Best regards
>
> Le 27/12/2009 04:05, kevinoversby a écrit :
>>
>>
>> FEEDBACK WELCOMED.
>>
>> I've made some progress on this and have the "upswing retracement"
>> clusters plotting quite nicely. Thanks to Mike, Joris, David&  Reinsley
>> for assistance so far.
>>
>> There are some unresolved issues with the bar indexing (x-axis) but
>> these do not affect the clusters, only the display of the swings used.
>> The last bar to use can be selected (by mouse) but best not to go too
>> far back, for the same reason.
>>
>> To be added: projections and time clusters then mirror image for downswings.
>>
>> // Amibroker 5.29
>> // Add to blank pane, ATR on chart should be<<  swing size
>> SetChartBkColor(ParamColor("Panel color ",1));
>> Plot(C,"",2,64);
>> n = Param("perc",0.3,0.1,0.6,0.05); //approx. 1-8 point swings on ES
>> t = Param("cluster tolerance",.5,.2,2,.1); //0-2 points
>> a = 0; b = 0; nl = 6; // 6 fib levels
>>
>> // Major visible swing
>>
>> Lvb = Status("lastvisiblebar");fvb = Status("firstvisiblebar");
>> Ly = LowestVisibleValue(L);
>> Hy = SelectedValue((HighestVisibleValue(H)));
>> Lx = fvb;Hx = Lvb; // can't get bar index to work for Ly&  Hy
>>
>> procedure retr(xt,yt,i)
>> {
>> Plot(LineArray(xt,yt,Hx,Hy), "", i+2,1 ); // plot swing
>> a[nl*i+0] = yt + .000 * (Hy - yt); // populate fib array for sorting
>> a[nl*i+1] = yt + .236 * (Hy - yt);
>> a[nl*i+2] = yt + .382 * (Hy - yt);
>> a[nl*i+3] = yt + .500 * (Hy - yt);
>> a[nl*i+4] = yt + .618 * (Hy - yt);
>> a[nl*i+5] = yt + .786 * (Hy - yt);
>> }
>>
>> if( Lx>  Hx ) // major visible swing down
>> {
>> // add mirror of next section
>> }
>> else // major visible swing up
>> {
>> retr(Lx,Ly,0); // plot major swing
>>
>> ns = 5; // minor swings (5)
>>
>> yt1=SelectedValue(Trough(L,n,1));
>> xt1=(BarCount - 1 - SelectedValue(TroughBars(L,n,1)));
>> yt2=SelectedValue(Trough(L,n,2));
>> xt2=(BarCount - 1 - SelectedValue(TroughBars(L,n,2)));
>> yt3=SelectedValue(Trough(L,n,3));
>> xt3=(BarCount - 1 - SelectedValue(TroughBars(L,n,3)));
>> yt4=SelectedValue(Trough(L,n,4));
>> xt4=(BarCount - 1 - SelectedValue(TroughBars(L,n,4)));
>> yt5=SelectedValue(Trough(L,n,5));
>> xt5=(BarCount - 1 - SelectedValue(TroughBars(L,n,5)));
>> yp1=SelectedValue(Peak(H,n,1));
>> xp1=(BarCount - 1 - SelectedValue(PeakBars(H,n,1))); //etc.
>>
>> if ( yt1>  Ly )
>> { retr(xt1,yt1,1); }
>>
>> if ( yt2<  yt1 AND yt2>  Ly ) // lower lows only
>> { retr(xt2,yt2,2); }
>>
>> if ( yt3<  yt1 AND yt3<  yt2 AND yt3>  Ly )
>> { retr(xt3,yt3,3); }
>>
>> if ( yt4<  yt1 AND yt4<  yt2 AND yt4<  yt3 AND yt4>  Ly )
>> { retr(xt4,yt4,4); }
>>
>> if ( yt5<  yt1 AND yt5<  yt2 AND yt5<  yt3 AND yt5<  yt4 AND yt5>  Ly )
>> { retr(xt5,yt5,5); }
>>
>> }
>>
>> // Plot clusters (upswing retracement only so far)
>>
>> for (j=0;j<=nl*ns+ns;j++) {
>> for (k=0;k<=nl*ns+ns;k++)
>> {
>> b[k] = a[k] - a[j];
>> }
>> if (LastValue(Cum(b<t AND b>0))>=3) { // Min. 3 levels for cluster
>> Plot(IIf(a[j]>0,a[j],-1e10),"",colorYellow);
>> }
>> }
>>
>> --- In amibroker@xxxxxxxxxxxxxxx<mailto:amibroker%40yahoogroups.com>,
>> reinsley<reinsley@xxx>  wrote:
>>   >
>>   >
>>   >  Nice Kevin,
>>   >
>>   >  In this case I dig out a post of Joris Schuller that can help Asis.
>>   >
>>   >  Best regards
>>   >
>>   >
>>   >  Since AB 5.25 (I believe) there are two undocumented functions
>>   >  HighestVisibleValue() and LowestVisibleValue();
>>   >  Joris Schueller
>>   >
>>   >  They replace:
>>   >
>>   >  fvb = Status("firstvisiblebar");
>>   >
>>   >  lvb =BarCount-1;//Status( "lastvisiblebar" );It now plots no matter with
>>   >  blank bars to the right… A. Faragasso
>>   >
>>   >  HHVMax=0; LLVMin=10000;
>>   >
>>   >  for( i = fvb; i<= Lvb; i++ )
>>   >
>>   >  {
>>   >
>>   >  HHVMax=Max(H[ i ],HHVMax);
>>   >
>>   >  LLVMin=Min(L[ i ],LLVMin);
>>   >
>>   >  }
>>   >
>>   >  with
>>   >
>>   >  HHVmax=HighestVisibleValue(H);
>>   >
>>   >  LLVMin=LowestVisibleValue(L);
>>   >
>>   >
>>   >
>>   >
>>   >  Le 24/12/2009 20:53, kevinoversby a écrit :
>>   >  >
>>   >  >
>>   >  >  Its using highestvisiblevalue which needs 5.25 minimum.
>>   >  >
>>   >  >  --- In amibroker@xxxxxxxxxxxxxxx
>> <mailto:amibroker%40yahoogroups.com>  <mailto:amibroker%40yahoogroups.com>,
>>   >  >  Asis Ghosh<subhamedicalsjpg@>  wrote:
>>   >  >  >
>>   >  >  >  In AB-4.8--its showing ERROR-30: Syntax Error probably in the
>> last para
>>   >  >  >  of this AFL--what to do ?
>>   >  >  >
>>   >  >  >  Asis
>>   >  >  >
>>   >  >  >
>>   >  >  >  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


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

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