Ara,

Thanks for posting the gfx functions.  I was finally able to make sense of 
things.  One thing I was not able to figure out, if the "diag" is not rem'd out 
I receive an error message.  What is the purpose of the "diag" condition?

Thanks again.

David K.

//Polygon pattern sample

Plot(C,"",IIf(C>O,27,IIf(C<O,32,55)),128|4);
        bi = BarIndex();
        pct  = Param( "Pivot %",0.18,0.10,60,0.01);

        //==============================
        pkID = PeakBars(H,pct)==0;
        trID = TroughBars(L,pct)==0;
        pk   = PeakBars(H,pct);
        tr   = TroughBars(L,pct);
        //==============================
        zHi=Zig(H,pct); zLo=Zig(L,pct); HLAvg=(zHi+zLo)/2;
        zp=IIf(pkID,zHi,IIf(trID,zLo,IIf(HLAvg>Ref(HLAvg,-1),H,L)));
        za=Zig(zp,pct);
        pR=Ref(za,-1)<za AND za>Ref(za,1);//pk
        pS=Ref(za,-1)>za AND za<Ref(za,1);//tr
        //==============================
procedure psa(x,y,shape,color,shift) 
{  
PlotShapes(IIf(BarIndex()==x,shape,0),color,0,y,shift); 
} 

function Spiv(array,x, back)
{
return SelectedValue(ValueWhen(array,x,back));  
}
        //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        //Pivots
        ys0=spiv(pS,L,1);   xs0=spiv(pS,bi,1);
        ys1=spiv(pS,L,2); xs1=spiv(pS,bi,2);
        yr0=spiv(pR,H,1);   xr0=spiv(pR,bi,1);
        yr1=spiv(pR,H,2); xr1=spiv(pR,bi,2);
        sup = xs0 >= xr0;
        res = xr0 >  xs0;

        psa(xs0,ys0,shapeDigit0,27,-10);
        psa(xs1,ys1,shapeDigit1,27,-10); 
        psa(xr0,yr0,shapeDigit0,32,10);
        psa(xr1,yr1,shapeDigit1,32,10); 

        //functions for Converting Chart prices to pixels

function GfxConvertBarToPixelX(bar)
{
        lvb = Status("lastvisiblebar");
        fvb = Status("firstvisiblebar");
        pxchartleft = Status("pxchartleft");
        pxchartwidth = Status("pxchartwidth");
/*
if ( diag )
{
//_TRACE("FP&T-xx " + " lvb " + WriteVal(Lvb,1.0) + " fvb " +
WriteVal(fvb,1.0) + "pxw " + WriteVal(pxchartwidth,1.0);
// + "pxleft " + WriteVal(pxchartleft,1.0));
}
*/
return pxchartleft + (bar - fvb) * 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 pxchartbottom - floor(0.5 + (Value - Miny) * pxchartheight / (Maxy - 
Miny));
}
        gyr0=gfxconvertvaluetopixely(yr0);
        gxr0=GfxConvertBarToPixelX(xr0);
        gyr1=gfxconvertvaluetopixely(yr1);
        gxr1=GfxConvertBarToPixelX(xr1);
        gxs0=GfxConvertBarToPixelX(xs0);
        gys0=gfxconvertvaluetopixely(ys0);
        gxs1=GfxConvertBarToPixelX(xs1);
        gys1=gfxconvertvaluetopixely(ys1);
        GfxSetOverlayMode(1);
if(sup==1)
{
        GfxSelectPen(19, 2); 
        GfxSelectSolidBrush(19); 
        GfxPolygon(gxs1,gys1,gxr0,gyr0,gxs0,gys0);
}
if(res==1)
{
GfxSelectPen( 24, 2); 
GfxSelectSolidBrush( 24); 
GfxPolygon(gxr1,gyr1,gxs0,gys0,gxr0,gyr0);
}

RequestTimedRefresh(1);
        //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Title = EncodeColor(55)+  Title = Name() + "     " + EncodeColor(32) + Date() + 
"      " + EncodeColor(5) + "{{INTERVAL}}  " +
        EncodeColor(55)+ "     Open = "+ EncodeColor(52)+ WriteVal(O,1.2) + 
        EncodeColor(55)+ "     High = "+ EncodeColor(5) + WriteVal(H,1.2) +
        EncodeColor(55)+ "      Low = "+ EncodeColor(32)+ WriteVal(L,1.2) + 
        EncodeColor(55)+ "    Close = "+ EncodeColor(52)+ WriteVal(C,1.2);

Reply via email to