there are better ways to do this, and you can do it without using a
loop. However to get you on right track and not take too much time, do
not place plotshape in loop and define an array for using in it to
define whcih bars are to be plotted with the shape. Here is a quick
fix to your code
I do not guarantee that the shapes are plotted where you want them,
but this should give you a direction for the corrections

Plot(C, "", colorWhite, styleCandle);
bp = bc = 0;
bcount = 0;
bperfect = 0;
for( i = 4; i < BarCount; i++ )
{
 if(bcount == 9)
 {
       bcount = 0;
       bperfect = 0;
 }
 if(Close[i] < Close[i-4])
 {
       bcount++;
       // for perfection, low of 8 or 9 must be less than lows of both 6 and 7
       if(bcount==8)
       {
               if((Low[i] < Low[i-1]) AND (Low[i] < Low[i-2]))
                       bperfect = 1;
       }
       if(bcount==9 AND bperfect==0)
       {
               if((Low[i] < Low[i-2]) AND (Low[i] < Low[i-3]))
                       bperfect = 1;
       }
 }
 else
 {
       bcount = 0;
       bperfect =0;
 }
 if((bcount == 9) AND (bperfect==1)){
       PlotText( "" + bcount, i, L[ i ]-.10, colorRed );
 }
 else if(bcount)
       PlotText( "" + bcount, i, L[ i ]-.10, colorYellow );
bc[i] = bcount;
bp[i] = bperfect;

}

PlotShapes(shapeDigit9*(bc==9 AND bp==1), colorBlue, 0, L, -20);

-- 
Cheers
Graham Kav
AFL Writing Service
http://www.aflwriting.com


On 27/09/2007, richcb750 <[EMAIL PROTECTED]> wrote:
> Anyone?  I'm new to AFL, so let me know if I'm doing something
> completely wrong.
>
> Thanks.
>
> --- In [email protected], "richcb750" <[EMAIL PROTECTED]> wrote:
> >
> > Anybody have any ideas on this?
> >
> > Thanks.
> >
> > --- In [email protected], "richcb750" <rwennis@> wrote:
> > >
> > > The following formula acts right when I use the commented out PlotText
> > > line.  But if I use the PlotShapes line instead, the shape is plotted
> > > for every bar.  What am I doing wrong with the plotshapes?
> > >
> > > Thanks,
> > > Richard
> > >
> > > bcount = 0;
> > > bperfect = 0;
> > > for( i = 4; i < BarCount; i++ )
> > > {
> > >  if(bcount == 9)
> > >  {
> > >     bcount = 0;
> > >     bperfect = 0;
> > >  }
> > >  if(Close[i] < Close[i-4])
> > >  {
> > >     bcount++;
> > >     // for perfection, low of 8 or 9 must be less than lows of both 6
> and 7
> > >     if(bcount==8)
> > >     {
> > >             if((Low[i] < Low[i-1]) AND (Low[i] < Low[i-2]))
> > >                     bperfect = 1;
> > >     }
> > >     if(bcount==9 AND bperfect==0)
> > >     {
> > >             if((Low[i] < Low[i-2]) AND (Low[i] < Low[i-3]))
> > >                     bperfect = 1;
> > >     }
> > >  }
> > >  else
> > >  {
> > >     bcount = 0;
> > >     bperfect =0;
> > >  }
> > >  if((bcount == 9) AND (bperfect==1)){
> > >     //PlotText( "" + bcount, i, L[ i ]-.10, colorRed );
> > >     PlotShapes(shapeDigit9, colorBlue, 0, L[i], -20);
> > >  }
> > >  else if(bcount){
> > >     PlotText( "" + bcount, i, L[ i ]-.10, colorBlack );
> > >  }
> > > }

Reply via email to