// Downloaded From https://www.WiseStockTrader.com // example code plotting convergence patterns, coded by E.M.Pottasch 2013 RequestTimedRefresh(0.1,True); xx=BarIndex();x=xx;Lx=LastValue(x); rightStrength=Param("Fractal Pivot Right side Strength",5,1,50,1); leftStrength=Param("Fractal Pivot Left side Strength",10,1,50,1); dispbe=ParamToggle("Display bearish Convergence","Off|On",1); dispbu=ParamToggle("Display bullish Convergence","Off|On",1); pk=H>Ref(HHV(H,leftStrength),-1) AND Ref(HHV(H,rightStrength),rightStrength)<=H; tr=L=L; px0=ValueWhen(pk,x,0); tx0=ValueWhen(tr,x,0); px1=ValueWhen(pk,x,1); tx1=ValueWhen(tr,x,1); px2=ValueWhen(pk,x,2); tx2=ValueWhen(tr,x,2); ph0=ValueWhen(pk,H,0); tl0=ValueWhen(tr,L,0); ph1=ValueWhen(pk,H,1); tl1=ValueWhen(tr,L,1); ph2=ValueWhen(pk,H,2); tl2=ValueWhen(tr,L,2); ll=tr AND tl1tl2; hh=pk AND ph1>ph2; lh=pk AND ph1O,colorGreen,IIf(C<=O,colorRed,colorLightGrey))); Plot(C,"Price",IIf(C>O,colorDarkGreen,IIf(C<=O,colorDarkRed,colorLightGrey)),64,0,0,0,0); PlotShapes(shapeSmallCircle*tr,IIf(Lx-ValueWhen(tr,x)>=rightStrength,ColorRGB(0,100,0),colorWhite),0,L,-10); PlotShapes(shapeSmallCircle*pk,IIf(Lx-ValueWhen(pk,x)>=rightStrength,ColorRGB(255,0,0),colorWhite),0,H,10); abcdy_up=27; abcdy_dn=15; function GetVisibleBarCount() { lvb=Status("lastvisiblebar"); fvb=Status("firstvisiblebar"); return Min(lvb-fvb,BarCount-fvb); } function GfxConvertBarToPixelX(bar) { lvb=Status("lastvisiblebar"); fvb=Status("firstvisiblebar"); pxchartleft=Status("pxchartleft"); pxchartwidth=Status("pxchartwidth"); return Nz(pxchartleft+bar*pxchartwidth/(lvb-fvb+1)); } function GfxConvertValueToPixelY(value) { local Miny,Maxy,pxchartbottom,pxchartheight; Miny=Status("axisminy"); Maxy=Status("axismaxy"); pxchartbottom=Status("pxchartbottom"); pxchartheight=Status("pxchartheight"); return Nz(pxchartbottom-floor(0.5+(Value-Miny)*pxchartheight/(Maxy-Miny))); } AllVisibleBars=GetVisibleBarCount(); fvb=Status("firstvisiblebar"); for(i=0;i