// Downloaded From https://www.WiseStockTrader.com _SECTION_BEGIN("Auto Fib Ext&Retrace"); // // TimingPundit.com // 4/14/2022 // Based on Candle body. I found this slightly better than tails // and much better than closing price. // Mode=ParamList("Retrace and/or Extensions","Both|Retracements|Extensions"); FibLines=ParamToggle("Fib Lines Shown","All|Last",1); FibLabels=ParamToggle("Label Fibs?","No|Yes",1); SPWidth=param("Swing Point Width",9,7,13,2); //suggest 7,9,13 arrows=ParamToggle("Swing POint Arrows","No|Yes",1); NE=Param("Number of Extensions",1,1,5,1); HV=HighestVisibleValue(H); LV=LowestVisibleValue(L); ymin=LV-.05*(hv-lv); ymax=HV+.05*(hv-lv); SetChartOptions(1,0,chartGridMiddle,ymin,ymax); HB=Max(C,O); LB=Min(C,O); sp1=sp2=0; sph = (HB==HHV(HB,SPWidth)) AND (HB==Ref(HHV(HB,SPWidth),SPWidth-1)); spl = (LB==LLV(LB,SPWidth)) AND (LB==Ref(LLV(LB,SPWidth),SPWidth-1)); fibmult1=.236; fibmult2=.382; fibmult3=.5; fibmult4=.618; fibmult5=.786; fibmult6=1; fibmult7=1.272; fibmult8=1.618; fibmult9=2.618; txt1=NumToStr(fibmult1); txt2=NumToStr(fibmult2); txt3=NumToStr(fibmult3); txt4=NumToStr(fibmult4); txt5=NumToStr(fibmult5); txt6=NumToStr(fibmult6); txt7=NumToStr(fibmult7); txt8=NumToStr(fibmult8); txt9=NumToStr(fibmult9); ////// Eliminates 2 SPL or 2 SPH in a row. Picks most extreme ///////// lasti=0; for(i=0;i<=BarCount-1;i++){ if(sph[i] AND sph[lasti]){ if(HB[i]>HB[lasti]){ sph[lasti]=0; }else{ sph[i]=0; } } if(spl[i] AND spl[lasti]){ if(LB[i]0){ range=delta[m]; SetFibs(); } } PlotFibs(); } } /* BuyPrice=LB; SellPrice=HB; Buy=spl; Sell=sph; Cover=Buy; Short=Sell; */ if(arrows){ shape=spl*shapeUpArrow+sph*shapeDownArrow; PlotShapes(shape,colorBlue,0,IIf(spl,Low,High)); } _SECTION_END();