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

[amibroker] BarsSince Question



PureBytes Links

Trading Reference Links

I think this idea is harder than it sounds, since one array may produce more
peaks and troughs than the other so that they will not necessarily follow in
sync or fall on the same bar as you might expect. For example, plot the code
below on CSCO to see that the Zig( Low ) generates more peaks/troughs than
the Zig( High ). I suppose this makes some sense, since prices often decline
more sharply than they advance. I have written the code to try and work
around this - It goes from high peak to next low trough to next high peak,
etc...   See if it is what you are looking for. It also plots the Zig(
High ) and Zig( Low ) for reference (see attached pic).

Steve

Pct = 10;

Peaks = PeakBars( High, Pct ) == 0;

Troughs = TroughBars( Low, Pct ) == 0;

Uptrend = Flip( Troughs, Peaks );

Point = Uptrend != Ref( Uptrend, -1 );

Point[BarCount-1] = 1;

Price1 = IIf( Uptrend, ValueWhen( Point, Low ), ValueWhen( Point, High ) );

Price2 = IIf( Uptrend, ValueWhen( Point, High, 0 ), ValueWhen( Point, Low,
0 ) );

Bar = BarIndex();

Bar1 = ValueWhen( Point, Bar );

Bar2 = ValueWhen( Point, Bar, 0 );

Slope = ( Price2 - Price1 ) / ( Bar2 - Bar1 );

Offset = Price1;

HiLoZig = ( Bar - Bar1 ) * Slope + Offset;

Plot( HiLoZig, "Zig ( Hi To Lo )", colorYellow, styleLine );

Plot( Zig( High, Pct ), "Zig ( Highs )", colorPaleGreen, styleLine );

Plot( Zig( Low, Pct ), "Zig ( Lows )", colorPink, styleLine );

Plot( Close, "Close", colorBlue, styleCandle );


----- Original Message ----- 
From: "Berti Fallada" <berti.fallada@xxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Tuesday, May 04, 2004 11:29 AM
Subject: [amibroker] ZigZag


> Does anyone know how to plot the ZigZag indicator from High to Low?
> (for Peak use High-array, for Trough use Low-array).
> The ZigZag function allows only one parameter (High or Low):
> zig(ARRAY, change )
>
> Thanks.
>
>
>
>
> 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
> Yahoo! Groups Links
>
>
>
>
>


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com.  Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

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 
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/
 

Attachment:
screenshot1.png

Attachment: Description: "Description: PNG image"