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

[amibroker] Re: Problem with the ZIG( 3rd TIME )


  • Date: Thu, 31 Dec 2009 03:52:33 -0000
  • From: "Mike" <sfclimbers@xxxxxxxxx>
  • Subject: [amibroker] Re: Problem with the ZIG( 3rd TIME )

PureBytes Links

Trading Reference Links



Yves,

Based on the description of Zig in MS, it should be doing the exact same thing as what AB is doing. It seems strange that your MS formula would produce the image that you have provided, since the image is very much NOT what  MS zig says it does (and is also not what AB Zig does).

Anyway, you will never get AB's Zig to produce the image that you have provided. However, you can write your own Zig function to do the job instead, as follows:

procedure MyZig( Array, MinValue, MaxValue, DownColor, UpColor ) {
    
local Tops, Bottoms;
    
local TrailingTop, TrailingBottom;
    
local Bar, FirstBar, LastBar;
    
local Rising, Y1, SecondLastPoint, LastPoint;

    Tops = Array == MaxValue;
    Bottoms = Array == MinValue;

    TrailingTop = LastTop =
0;
    TrailingBottom = LastBottom =
0;

    FirstBar =
0; // Set to Status("firstvisiblebar") for better performance
    LastBar =
min( BarCount - 1, Status( "lastvisiblebar" ) );

    
for ( Bar = FirstBar; Bar <= LastBar; Bar++ ) {
        
if ( Tops[Bar] ) {
            
if ( LastBottom ) {
                
// Draw previous down leg
                Y1 =
IIF( IsNull( Array[TrailingTop] ), 0, Array[TrailingTop] );
                
Plot( LineArray( TrailingTop, Y1, LastBottom, Array[LastBottom] ), "", DownColor, styleNoLabel );
                TrailingBottom = LastBottom;
                LastBottom =
0;
            }

            LastTop = Bar;
        }
else if ( Bottoms[Bar] ) {
            
if ( LastTop ) {
                
// Draw previous up leg
                Y1 =
IIF( IsNull( Array[TrailingBottom] ), 0, Array[TrailingBottom] );
                
Plot( LineArray( TrailingBottom, Y1, LastTop, Array[LastTop] ), "", UpColor, styleNoLabel );
                TrailingTop = LastTop;
                LastTop =
0;
            }

            LastBottom = Bar;
        }
    }

    Rising = LastBottom > LastTop;
    SecondLastPoint =
IIF( Rising, TrailingTop, TrailingBottom );
    LastPoint =
IIF( Rising, LastBottom, LastTop );

    
Plot( LineArray( SecondLastPoint, Array[SecondLastPoint], LastPoint, Array[LastPoint] ), "", IIF( Rising, DownColor, UpColor ), styleNoLabel );
    
Plot( LineArray( LastPoint, Array[LastPoint], BarCount - 1, LastValue( Array ) ), "", IIF( Rising, UpColor, DownColor ), styleNoLabel );
}

Indic =
CCI( 21 ) ;
YL =
IIf( Indic > 100, 100, IIf( Indic < -100, -100, Indic ) );

Plot( YL, "", colorRed );
MyZig( YL, -
100, 100, colorBlue, colorBlue );

Mike 
--- In amibroker@xxxxxxxxxxxxxxx, Yves <yltech@xxx> wrote:
>
> You Have below my formula in MS
> You have YOUR TRANSLATION of MS in AB
>
> See the screen in the file Z-CCI with MS.gif and see the file Z-CCI with AB.gif
>
> With AB for the ThroughBars, I'm obtain an AREA for the ThroughBars
>
> With MS I'm obtain only ONE DAY and it's O.K.
>
> Why I can't obtain that with AB
>
> And all time for the ThroughBars, I'm obtain alway time an AREA(see Z-CCI with AB Ex2.gif or Z-CCI with AB Ex3.gif)
>
> I'm used MetaStock(MS) around 10 year
>
> I'm use Amibroker(AM) around 3 month
>
> AB is maybe the best BUT
>
> I can make the same think with AB of MS
>
> Because I don't Know How write THAT ?
>
>
>
> In MS
> In AB
>
> Indic := CCI(21) ;
>
> YL:= If(Indic>100,100,
>
> If(Indic<-100,-100,Indic)) ;
>
>
> {yl;
>
> Zig(YL,200,%) ;}
>
> TroughBars(1,YL,200)=0 ;
> _SECTION_BEGIN("Z-CCI");
>
> Indic = CCI(21) ;
>
> YL = IIf(Indic>100,100, /*{give me the Top } */
>
> IIf(Indic<-100,-100,Indic)); //{give me the Bottom }
>
> yl; //{my CCI }
>
> Plot(Zig(YL,200), "", colorBlue); //{my
>
> Plot(yl, "", colorRed);
>
> //Plot(TroughBars(YL,200)==0,"", colorBlack,styleOwnScale);
>
> _SECTION_END();
>
>
>
> Thank
> Merci
>
> YLTech ( Yves L. )
>
> Le présent message et les documents qui y sont joints sont réservés exclusivement au destinataire indiqué. Il est strictement interdit d'en utiliser ou d'en divulguer le contenu. Si vous recevez le présent message par erreur, veuillez le détruire S.V.P. et nous en aviser immédiatement afin que nous puissions corriger nos dossiers. Merci.
>
> This message and the attached documents may contain privileged or confidential information that are intended to the addressee only. Any unauthorized disclosure is strictly prohibited. If you happen to receive this message by error, please delete it and notify us immediately so that we may correct our internal records. Thank you.
>
> yltech@xxx
>
> ----- Original Message -----
> From: Mubashar Virk
> To: amibroker@xxxxxxxxxxxxxxx
> Sent: Saturday, December 26, 2009 4:17 AM
> Subject: Re: [amibroker] Problem with the ZIG( 2nd TIME )
>
>
>
>
> I don't know.
> Maybe Yves knows something new.
>
>
> On 12/26/2009 1:50 PM, Graham wrote:
>
> What result do you get from a 200% zig? This makes no sense as you cannot get 200% change to create a peak point.
>
>
> --
> Cheers
> Graham Kav
> AFL Writing Service
> http://www.aflwriting.com
>
>
>
> 2009/12/26 Mubashar Virk mvirk67@xxx
>
>
>
> I think it is the same. Please see:
> Indic = CCI(21) ;
> YL = IIf(Indic>100,100,IIf(Indic<-100,-100,Indic)) ;
> Top1 = PeakBars(YL,200,1) ;//????
> Top2 = PeakBars(YL,200,2) ;//????
> Plot(yl, "Z-CCI", colorRed);
> Plot(Zig(YL,200), "ZIG", colorBlue);
> Plot(TroughBars(YL,200,1)==0, "", colorWhite, styleOwnScale);
>
>
>
> On 12/26/2009 10:18 AM, Yves wrote:
> Indic := CCI(21) ;
>
> YL:= If(Indic>100,100,
>
> If(Indic<-100,-100,Indic)) ;
>
> Top1 := PeakBars(1,YL,200) ;
>
> Top2 := PeakBars(2,YL,200) ;
>
> yl;
>
> Zig(YL,200,%) ;
>
> {TroughBars(1,YL,200)=0 ;}
>
> {
>


__._,_.___


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





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

__,_._,___