[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] The Theory of Zig and How to make it Work



PureBytes Links

Trading Reference Links

Yes.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: Ken Close
Sent: Friday, October 31, 2008 10:15 PM
Subject: RE: [amibroker] The Theory of Zig and How to make it Work

Hi Steve:
 
The Zig Zag Trend Indicator that TJ referenced back to the 2004 article does just what you say.  It checks that the new advance has in fact advanced (or fallen) "far enough" so that the zig percent is satisfied.  If I understand the theory, it is ok to trade/backtest off of this code because the signals (which do NOT occur at the precise bottom (trough) or top (peak) of the price chart) but some number of bars past those extremes.  Signals from this code will not disappear or change after several more bars pass.
 
Do I understand it correctly?
 
Ken


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Steve Dugas
Sent: Friday, October 31, 2008 12:50 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] The Theory of Zig and How to make it Work

Hi Ken - It looks into the future because it needs to do that in order to determine where the peaks and troughs are. For example, in order to recognize a peak, it needs to know that both the bars before it and the bars after it are lower. I have attached a couple of charts, using trendlines to simulate the Zig, to show why it can be tough to use in real-time.  In the first chart the market has made a bottom and started back up, but it has not yet reversed by the necessary "zig percent" required to create a new leg and so it is still working on the big down leg. In the second chart ( one bar later ), price has moved up a bit further, it has now retraced by the required zig percent, and so the Zig has created a new leg ( up ) and *redrawn* the down leg to end at the previous low which it now recognizes as an "official" trough. That's how it works in real-time, one day you will look at it and see a new "signal" but by that time you will have already missed a big chunk of the move and may in fact get long just when the price is about ready to reverse back down again...
 
Steve
----- Original Message -----
From: Ken Close
Sent: Friday, October 31, 2008 8:36 AM
Subject: RE: [amibroker] The Theory of Zig and How to make it Work

Thanks TJ, David, Graham:
 
Now, if you care to explain something else about the Trader's Tip code for "The ZigZag Trend Indicator"
 
These are the two important lines which help determine that the Zig has moved a "confirming amount" in the new trend direction, and thus you can switch to the "other side" of the ZigZag movement.
 

PU = tr + 0.01 * abs(tr)*amount;

PD = pk - 0.01 * abs(pk)*amount;

Now, take the "factor" 0.01 and make it smaller. This has the effect of moving the buy/sell arrows closer to the peak.  The CAR of this "adjusted" system will be higher than if you leave the original 0.01 factor in place.  Is it then "looking into the future"??
 
 


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Tomasz Janeczko
Sent: Thursday, October 30, 2008 6:25 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] The Theory of Zig and How to make it Work

Hello,
 
Look here for example of how zig-zag is coded:
 
The meaning that it looks into the future is that
zig-zag requires certain number of bars (depending on threshold specified)
to find out the direction, once the threshold is reached it changes
PAST values. So in real-time trading you would not get those
signals that zig-zag generates until the price movement since last peak/trough is bigger than threshold.
This is "after the fact" diagnosis, similar to what humans do when they
speak "if I bought one year ago I would be rich because I now see the trend".
 
Actually Zig-zag can be used for trading if only trading signals generated by it
are DELAYED as much as it is necessary to confirm the movement in given direction.
Exact code how to do this is given in Traders' Tips:

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: Ken Close
Sent: Thursday, October 30, 2008 10:25 PM
Subject: [amibroker] The Theory of Zig and How to make it Work

A friend asked me why he can not trade with the Zig indicator.
I answered: "Because it looks into the future."
He said, "What does that really mean?"
I said: "It looks into the future."
He said, "Huh".
 
Can someone explain, without using the words "It looks into the future", why the Zig indicator can not work.
How is it coded internally?  What makes it work--plot that is?"
 
I found some code on my hard drive from 2004 called "Zig Zag Safe to Use".  I will copy the code below.
Why does this code say that it is "Safe to Use"?
What do you look at, what does the several adjustment values do, that makes it safe?
 
Any explanations in english, that are easy to understand?
Will this code be safe to trade?
 
Thanks,
Ken
============================================================
 
array = Close;
amount = Param("Amount", 5, 1, 50, 0.5 );
adjust = Param("adjust",0.001,0.001,0.10,0.001);
zz0 = Zig( array, amount );
zz1 = Ref( zz0, -1 );
zz2 = Ref( zz0, -2 );
tr = ValueWhen(zz0 > zz1 AND zz1 < zz2, zz1);
pk = ValueWhen(zz0 < zz1 AND zz1 > zz2, zz1);
PU = tr + 0.01 * abs(tr)*amount;
PD = pk - 0.01 * abs(pk)*amount;
ZZT = IIf( array >= PU AND zz0 > zz1, 1,
IIf( array <= PD AND zz0 < zz1, -1, 0 ) );
ZZT = ValueWhen( ZZT != 0, ZZT );
// plot price bar chart
Plot( Close, "Price", 1, styleLine );
// plot Zigzag and zigzag trend
Plot( ZZT, "ZigZagTrend", colorRed, styleOwnScale );
Plot( zz0, "ZigZag line", colorBlue, styleThick );
// Plot the ribbon
ribboncol= IIf( ZZT > 0, colorGreen, colorRed );
Plot( 2, "ZZT Ribbon", ribboncol, styleArea | styleOwnScale | styleNoLabel, 0, 100 );
GraphXSpace = 10;
Buy = Cover = Cross( ZZT, 0 );
Sell = Short = Cross( 0, ZZT );
// plot arrows
PlotShapes( Buy + 2 * Sell, ribboncol, 0, IIf( Buy, L, H ), -30 );
 
__._,_.___

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
*********************

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html

*********************************




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___