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

Re: [amibroker] Re: Peak & Zig Zag



PureBytes Links

Trading Reference Links




Hi,
 
I was wondering if anyone has read the Nov. 2003 TASC  article about 
ZigZag trend indicator. 
 
The author claims it to be a tradeable indicator because it solves 
theproblem of the dynamic last leg.
 
 I was thinking this might be adapted with a validating signal such as 
TRIX and or StoRSI but I haven't tested any further .  Anybody have any 
thoughts about the TASC article and/or the indicator?
 
Greg
 
Here is the code that TJ programmed:
 

/*THE ZIGZAG TREND INDICATOR
In "The Zigzag Trend Indicator" article Spyros Raftopoulos presents an 
enhancement of his zigzag validity indicator. A new Zigzag Trend indicator is an 
attempt to address shortcomings (mainly 'last leg' problem) of classic zigzag. 
The technique involves delaying the response of the indicator as long as 
reversal amount is reached AND last leg of zigzag line becomes valid AND can be 
easily reproduced in AmiBroker using its native AFL language. Listing 1 shows 
ready-to-use code that can be applied in Indicator Builder. It includes also a 
very basic reversal trading system to be applied in Automatic Analysis window. 
The percentage reversal amount can be changed on-the-fly without modifying the 
code using the Parameters window.
LISTING 1*/
array = Close;
amount = Param<FONT 
size=1>("Amount", 
6, 
1, <FONT 
color=#ff00ff size=1>50, <FONT color=#ff00ff 
size=1>0.5 );
zz0 = Zig( 
array, amount );
zz1 = Ref( zz0, 
-1 );
zz2 = Ref( zz0, 
-2 );
tr = ValueWhen<FONT 
size=1>(zz0 > zz1 AND zz1 < zz2, zz1);
pk = ValueWhen<FONT 
size=1>(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, <FONT color=#ff00ff 
size=1>1,
IIf( array <= PD AND zz0 < zz1, 
-1, <FONT 
color=#ff00ff size=1>0 ) );
ZZT = ValueWhen( 
ZZT != 0, ZZT 
);
// plot price bar chart
Plot( Close, <FONT color=#ff00ff 
size=1>"Price", colorBlack, styleBar 
);
// plot Zigzag and zigzag trend 
Plot( ZZT, <FONT color=#ff00ff 
size=1>"ZigZagTrend", colorRed, styleOwnScale 
); 
Plot( zz0, "ZigZag 
line", colorBlue, styleThick 
);
// Plot the ribbon
ribboncol= IIf( 
ZZT > 0, 
colorGreen, colorRed ); 
Plot( 2<FONT 
size=1>, "ZZT Ribbon", 
ribboncol, styleArea | styleOwnScale | styleNoLabel, 
0, <FONT 
color=#ff00ff size=1>100 );
GraphXSpace = 10<FONT 
size=1>;
Buy = Cover = <FONT color=#0000ff 
size=1>Cross( ZZT, <FONT color=#ff00ff 
size=1>0 );
Sell = Short = <FONT color=#0000ff 
size=1>Cross( <FONT color=#ff00ff 
size=1>0, ZZT );
// plot arrows
PlotShapes( Buy + <FONT color=#ff00ff 
size=1>2 * Sell, ribboncol, <FONT 
color=#ff00ff size=1>0, <FONT color=#0000ff 
size=1>IIf( Buy, L, H ), 
-30 );
 
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  Jayson 
  
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Monday, November 24, 2003 3:29 
  PM
  Subject: RE: [amibroker] Re: Peak & 
  Zig Zag
  
  The 
  Challenge Phsst is that the legs can changed based on future data in which 
  case your buy or sell signal can simply vanish in the back test. Zig can be 
  very useful in real time but like every thing else in Real time you simply can 
  not know for sure until time has past if your signal was in fact valid or not. 
  A back test using zig (or peak or trough) will always show you the best 
  signals only and none of the failed signals.
   
  Regards, 
  Jayson 
  <FONT face=Tahoma 
  size=2>-----Original Message-----From: Phsst 
  [mailto:phsst@xxxxxxxxx]Sent: Monday, November 24, 2003 1:57 
  PMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] Re: 
  Peak & Zig ZagExcuse me... Enter key on Subject 
  Line gets me too often.It is clear that Zig Zag *can* give unrealistic 
  test results becauseit looks into the future. This is documented. But 
  there is almost thecaveat *can* included in the caution.But are 
  there any known conditions where test results can be relied upon.For 
  example if a calculated trendline up to the current bar is morethan a few 
  bars old, and is linear for those past bars, and correlates(for lack of a 
  better word) with current bar close price,  does thisnot perhaps mean 
  that an assumption can be safely made that futureprices have not yet 
  influenced the current 
  trend?Regards,PhsstSend BUG REPORTS 
  to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Your use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of Service. 
  Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Your use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of Service. 







Yahoo! Groups Sponsor


  ADVERTISEMENT 









Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.