Hello,
I can't figure out why the code I have copied and pasted prints some
but not all of the vertical bars listed in the procedure. The shapes
plot in the proper location but only some of the bars plot. I know I
can use cross to make things simple but I want to avoid using cross
since the next step will be to plot the bars in the blank chart space
using future arrays. I don't thing cross will work for future bars.
Thanks,
David K.
_SECTION_BEGIN("Fib Time");
pct = Param("Pivot %",0.09,0.04,60,0.01);
Hlb = Param (" Hi Pivots Back",1,1,100,1);
Llb = Param ("Low Pivots Back",1,1,100,1);
ext = Param("Extend Right",15,0,50,1);
col= Param("Color Start #",30,1,60,1);
pS=TroughBars(L,pct,1)==0;
pR=PeakBars(H,pct,1)==0;
xs1=SelectedValue(ValueWhen(pS,bi,Llb));
xr1= SelectedValue(ValueWhen(pR,bi,Hlb));
xr=BarIndex()==xr1;
xs=BarIndex()==xs1;
Plot(xs,"",33,2+styleLeftAxisScale|styleOwnScale|styleNoLabel);
Plot(xr,"",43,2+styleLeftAxisScale|styleOwnScale|styleNoLabel);
tx=IIf(xr1>xs1,xr1,xs1);
d = abs(round(xr1-xs1));
K=0;
Title="";
procedure pf(f,col)
{
K = K+1;
PlotShapes(shapeSmallCircle*(BarIndex()-tx==int((f*d))),col);
fx=-BarIndex()+tx+(f*d);
Plot(fx==0,"",col,2+styleLeftAxisScale|styleNoLabel);
Title=Title+WriteIf(fx>0,"\n "+NumToStr((f*100),1.2)+"% = "+WriteVal
(fx,1.0)+" bars","");
}
pf(0,col);
pf(0.382,36);
pf(0.50,29);
pf(0.618,43);
pf(1.0,55);
pf(1.618,34);
pf(2.0,23);
pf(2.62,10);