Hi all,

I have no formal programming experience.

I am trying to write a formula for Fib. price and time analysis using multiple pivots, without any lines being drawn on the price bars. [ using the inbuilt studies creates numerous horizontal (price studies] and vertical

lines [time studies] on the price chart.

Below is an AFL for plotting Fib price retracements and external extensions / projections in the RHS clear area of a chart using the range markers (vertical lines --green-start and red -end) to select the start and end value.

Using range markers the retracements can only be drawn once.

My current path is to use "click" of mouse buttons to select the high and low values for drawing the fib.

price retracements and projections. Been struggling and no success. When I use the right mouse button

the drop down menu (parameters ---------close) opens on the chart.

Can some AFL expert please guide me how to plot fib price rets. from multiple pivots, ie more than once !

Further an AFL drawing "extensions" [3 pivots require to be selected] .

I have struggled with using mouse button clicks , have had no success, therefore asking for help !

Thanks.

```
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
TC = IIf(C > Ref(C,-1),colorGreen , colorRed);
Plot( C, "Close", TC, styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();
_SECTION_BEGIN("FIBS");
/*---------------------------------------------------
Another Fib Level
Based on Aron Pipa's formula , December, 11, 2005
* Under Parameters, select "axis & Grid" ,
"show date axis" = "yes"
* Dash lines are the fib extentions
* If you are not familiar with begin/end values double
click a lot around the screen til you get the idea
* Select your fib retrace in a higher timeframe e.g.
daily and view chart in e.g. 5 min, to see magor
retracement lines.
--------------------------------------------------------*/
EnableTextOutput(0);
// Get values for fib levels
// Get values for fib levels
StartBar=BeginValue(BarIndex());
EndBar = EndValue( BarIndex() );
LastBar=BarCount-1;
period = EndBar - StartBar;
Lo =LLV(L,period);
Hi = HHV(H,period);
HiEnd = EndValue(H);
HiStart = BeginValue(H);
Line0 = IIf(HiEnd >HiStart , EndValue(H),EndValue(L));
Line100 = IIf( HiEnd <HiStart , BeginValue(H), BeginValue(L));
Line1 = IIf(HiEnd >HiStart, Line0 - abs(Line100-Line0)*0.236, Line100 - abs(Line100-Line0)*0.236);
Line2 =IIf(HiEnd >HiStart, Line0 -abs(Line100-Line0)*0.382, Line100 - abs(Line100-Line0)*0.382);
Line3 = IIf(HiEnd >HiStart, Line0 - abs(Line100-Line0)*0.5, Line100 - abs(Line100-Line0)*0.5);
Line4 = IIf(HiEnd >HiStart, Line0 - abs(Line100-Line0)*0.618, Line100 - abs(Line100-Line0)*0.618);
Line5 = IIf(HiEnd >HiStart, Line0 - abs(Line100-Line0)*0.786, Line100 - abs(Line100-Line0)*0.786);
//EXTENSIONS
Line1DZ = IIf(HiEnd >HiStart, Line100 - abs(Line100-Line0)*0.128, Line100 + abs(Line100-Line0)*0.128);
Line2DZ = IIf(HiEnd >HiStart, Line100- abs(Line100-Line0)*0.272, Line100 + abs(Line100-Line0)*0.272);
LineGR = IIf(HiEnd >HiStart, Line100 - abs(Line100-Line0)*0.618, Line100 + abs(Line100-Line0)*0.618);
// Plot
plotfibRET = ParamToggle( "PLOT FIB RET","OFF|ON",0);
if(plotfibRET)
{
GfxSetZOrder( 5 );
GfxSetCoordsMode( 1 );
GfxSelectPen(colorPink,1,1);
GfxMoveTo(EndBar,Line100);
GfxLineTo(LastBar+1,Line100);
GfxSelectPen(colorPink,2,0);
GfxMoveTo(LastBar+1,Line100);
GfxLineTo(LastBar+10,Line100);
GfxSelectPen(colorPink,1,1);
GfxMoveTo(startBar,Line0);
GfxLineTo(LastBar+1,Line0);
GfxSelectPen(colorPink,2,0);
GfxMoveTo(LastBar+1,Line0);
GfxLineTo(LastBar+10,Line0);
GfxSelectPen(colorPaleBlue,2,0);
GfxMoveTo(LastBar+1,Line1);
GfxLineTo(LastBar+10,Line1);
GfxSelectPen(colorBrightGreen,2,0);
GfxMoveTo(LastBar+1,Line2);
GfxLineTo(LastBar+10,Line2);
GfxSelectPen(colorRed,2,0);
GfxMoveTo(LastBar+1,Line3);
GfxLineTo(LastBar+10,Line3);
GfxSelectPen(colorBlue,2,0);
GfxMoveTo(LastBar+1,Line4);
GfxLineTo(LastBar+10,Line4);
GfxSelectPen(colorGrey40,2,0);
GfxMoveTo(LastBar+1,Line5);
GfxLineTo(LastBar+10,Line5);
PlotText( "100% = "+Line100, BarCount+10,line100 ,colorPink) ;
PlotText( "0% = "+Line0, BarCount+10, line0 ,colorPink) ;
PlotText( "78.6%RET = "+Line5, BarCount+10,line5 ,colorGrey40) ;
PlotText( "61.8%RET = "+Line4, BarCount+10,line4 ,colorBlue) ;
PlotText( "50%RET ="+Line3, BarCount+10,line3 ,colorRed) ;
PlotText( "38.2% RET= "+Line2, BarCount+10,line2 ,colorBrightGreen) ;
PlotText( "23.6% RET= "+Line1, BarCount+10,line1 ,colorPaleBlue) ;
}
// SHOW EXTENSIONS
SHOWEXT = ParamToggle("SHOW EXTENSIONS","OFF|ON",0);
if(SHOWEXT)
{
GfxSelectPen(colorBlue,2,0);
GfxMoveTo(LastBar+1,Line1DZ);
GfxLineTo(LastBar+10,Line1DZ);
GfxSelectPen(colorBlue,2,0);
GfxMoveTo(LastBar+1,Line2DZ);
GfxLineTo(LastBar+10,Line2DZ);
GfxSelectPen(colorGold,2,0);
GfxMoveTo(LastBar+1,LineGR);
GfxLineTo(LastBar+10,LineGR);
PlotText( "121.8% EXT= "+Line1DZ, BarCount+10,line1DZ ,colorBlue) ;
PlotText( "127.2% EXT= "+Line2DZ, BarCount+10,line2DZ ,colorBlue) ;
PlotText( "161.8% EXT= "+LineGR, BarCount+10,lineGR ,colorGold) ;
}
// Title
/*
Title= StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) )+"\n Automatic Fib Levels "+"\n"+"\n"+
EncodeColor( colorGold ) + " 161.8% = "+LineGR +" " +"\n"+
EncodeColor( colorBlue ) + " 127.2% = "+Line2DZ +" " +"\n"+
EncodeColor( colorBlue) + " 112.8% = "+Line1DZ +" " +"\n"+
EncodeColor( colorPink ) + " 100% = "+Line100 +" " +"\n"+
EncodeColor( colorGrey40 ) + " 78.6% = "+EncodeColor( colorGrey40 )+Line5 +" "+"\n"+
EncodeColor( colorBlue) + " 61.8% = "+EncodeColor( colorBlue )+Line4 +" "+"\n"+
EncodeColor( colorRed ) + " 50.0% = "+EncodeColor( colorRed )+Line3 +" "
+"\n"+
EncodeColor( colorBrightGreen) + " 38.2% = "+EncodeColor( colorBrightGreen )+Line2 +" "
+"\n"+
EncodeColor( colorPaleBlue) + " 23.6% = "+EncodeColor( colorPaleBlue )+Line1 +" "
+"\n"+
EncodeColor( colorPink ) + " 0% = "+Line0;
_SECTION_END( );
```