PureBytes Links
Trading Reference Links
|
Dave,
O.K. but haven't really checked the code out thoroughly and will
probably want to convert it to a .dll before too long. And lastly, it
bears a strong resemblance to several other codes floating around so
hope I don't get too many people mad.
Aequalsz
//
// AFL High-Low ZigZag code.
//
function FillLine( startbar, startval, endbar, endval )
{
global ZigArray;
for( j = startbar; j <= endbar; j++ )
{
ZigArray[ j ] = startval + ( j - startbar) * (endval-startval)/(
endbar -startbar );
}
return ZigArray;
}
WavePcnt = Param("Percent",15,0,100,1);
RP = ( High[0] + Low[0] )/2.0;
RPPoint = 0;
RP1 = RP;
RPPoint1 = RPPoint;
Switch = 0;
for(i=0; i<BarCount; i++)
{
ZigArray[i] = -1.0E10;
// Swing High
if( i>0 AND i<BarCount-2 AND H[i]>=H[i-1] AND H[i]>=H[i+1] )
SH = H[i];
else
SH = -1;
// Swing Low
if( i>0 AND i<BarCount-2 AND L[i]<=L[i-1] AND L[i]<=L[i+1] )
SL = L[i];
else
SL = -1;
// ZigZag
if( SH != -1)
{
if(Switch != 1 AND SH >= RP*(1+0.01*WavePcnt) )
{
RPPoint1 = RPPoint;
RP1 = RP;
RPPoint = i;
RP = SH;
FillLine( RPPoint1, RP1, RPPoint, RP );
Switch = 1;
}
else
if(Switch == 1 AND SH >= RP)
{
RPPoint = i;
RP = SH;
FillLine( RPPoint1, RP1, RPPoint, RP );
}
}
if( SL != -1)
{
if(Switch != -1 AND SL <= RP*(1-0.01*WavePcnt) )
{
RPPoint1 = RPPoint;
RP1 = RP;
RPPoint = i;
RP = SL;
FillLine( RPPoint1, RP1, RPPoint, RP );
Switch = -1;
}
else
if(Switch == -1 AND SL <= RP)
{
RPPoint = i;
RP = SL;
FillLine( RPPoint1, RP1, RPPoint, RP );
}
}
}
Plot(Close,"Prices",colorBlack,styleCandle);
Plot(ZigArray,"ZA",colorBlack,styleLine+styleThick);
--- In amibroker@xxxxxxxxxxxxxxx, "Dave Merrill" <dmerrill@xxxx>
wrote:
> I'd be interested in seeing what you came up with, if you'd consider
> sharing.
>
> Thanks,
>
> Dave Merrill
> Stephane,
>
> Already got my High-Low ZigZag code working and it looks correct
to
> me. But will check it against your code if you want.
>
> Aequalsz
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> 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/
|