Asis,
usually the error is highlighted...is the line
highlighted ?
Also, 4.8 is old version...usually new functions
are added in newer versions...that could be cause for error...
Tomasz has stated before that we should insert what
version we have written our formulas in..
Anthony
----- Original Message -----
Sent: Thursday, December 24, 2009 8:59
AM
Subject: Re: [amibroker] Re: Writing a
fib cluster indicator
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>
Kevin
--- In amibroker@xxxxxxxxxps.com <mailto:amibroker%40yahoogroups.com>,
reinsley <reinsley@xxx> 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@xxxxxxxxxps.com
<mailto:amibroker%40yahoogroups.com> [mailto:amibroker@yahoogroups.com
<mailto:amibroker%40yahoogroups.com>] *On
> > Behalf Of *reinsley
> > *Sent:* Wednesday, December 23, 2009 4:00 AM
> > *To:* amibroker@xxxxxxxxxps.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@xxxxxxxxxps.com
<mailto:amibroker%40yahoogroups.com>
> > <mailto:amibroker%40yahoogroups.com>
[mailto:amibroker@yahoogroups.com <mailto:amibroker%40yahoogroups.com>
> > <mailto:amibroker%40yahoogroups.com>] *On
> > > Behalf Of *Joris Schuller
> > > *Sent:* Tuesday, December 22, 2009 3:56 PM
> > > *To:* amibroker@xxxxxxxxxps.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@xxxxxxxxxps.com
<mailto:amibroker%40yahoogroups.com>
> > <mailto:amibroker%40yahoogroups.com>
[mailto:amibroker@yahoogroups.com <mailto:amibroker%40yahoogroups.com>
> > <mailto:amibroker%40yahoogroups.com>] *On
> > > Behalf Of *kevinoversby
> > > *Sent:* Monday, December 21, 2009 3:35 PM
> > > *To:* amibroker@xxxxxxxxxps.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@xxxxxxxxxps.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,
|