PureBytes Links
Trading Reference Links
|
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);
------------------------------------
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|