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

FW: [amibroker] Problem with the ZIG [1 Attachment]


  • Date: Wed, 30 Dec 2009 23:58:49 -0600
  • From: "Joris Schuller" <jschuller@xxxxxxxxxxx>
  • Subject: FW: [amibroker] Problem with the ZIG [1 Attachment]

PureBytes Links

Trading Reference Links

<*>[Attachment(s) from Joris Schuller included below]

I might have sent this to myself rather than to the group.  Since the
contents are not earth shattering, a few days delay will not kill anyone.

_____________________________________________
From: Joris Schuller [mailto:jschuller@xxxxxxxxxxx] 
Sent: Sunday, December 27, 2009 10:17 AM
To: 'Joris Schuller'
Subject: RE: [amibroker] Problem with the ZIG


I addressed this problem before (see Dec 13). However, let's give it another
try, since no one seems to address the point, which is:
The Zig does not work correctly with negative values for the indicator.
Then the Zig will be set to the value of the indicator (essentially
ZigPercChg is set to zero).

Don't ask me why:  The short answer is, I don't know.  Perhaps, it was
developed for stocks/equities and the programmer didn't anticipate its use
in indicators with negative values.
So a simple workaround is to temporarily offset the indicator with a value
such that the indicator is >=0, then compute the ZIG values and then
subtract the offset from it. The three cases below show for the general
case: 1. Correct use, 2.  Maintaining the Peak/Trough relationship during
the offset and 3. Incorrect use.  Your case (clamping of the CCI) is shown
at the end.
Play with it and it should become pretty clear what happens.

PercChangeCorrect= Param( "PercChangeCorrect", 10, 0, 100, 1 ); 
PercChangeShifted = Param( "PercChangeShifted ", 10, 0, 100, 1 ); 
PercChangeIncorrect = Param( "PercChangeIncorrect ", 10, 0, 100, 1 ); 
periods = Param( "Periods", 14, 2, 200, 1 ); 
ZigsOnly= ParamToggle("ZigsOnly","No|Yes",0); 
CCINegOffset=LowestVisibleValue(CCI(Periods)); //For general computation
purposes take LLV(CCI(periods),barcount-1) 
CCIPos=CCI( periods )-CCINegOffset;//Adjusted with min amount necessary to
have non-negative (positive) values 
CCIPosNoOffset=CCI( periods );//No adjustment for negative values 
if (!ZigsOnly) 
{ 
//============== Case 1: Correct: With CCI temporarily offset to positive
values and then restored to original value=============== 
Plot(CCI( periods ), "\nCCI("+WriteVal(periods,1.0)+")", colorBlack,5 ); 
Plot(Zig(CCIPos,PercChangeCorrect)+CCINegOffset,"Zig("+WriteVal(PercChangeCo
rrect,1.0)+")",colorRed,5); 
//============== Case 2: Correct relationship, but CCI and Zig still
shifted:  No Offset correction applied================ 
//Demonstrates that correct Peak/trough detection is maintained. 
Plot(CCIPos, "\nCCIShifted("+WriteVal(periods,1.0)+")",
colorGreen,styleLeftAxisScale|5 ); 
Plot(Zig(CCIPos,PercChangeShifted ),"ZigShifted("+WriteVal(PercChangeShifted
,1.0)+")",colorGreen,styleLeftAxisScale|5); 
//============== Case 3: Incorrect, with CCI as
is=============================================== 
Plot(CCI( periods ), "\nCCI("+WriteVal(periods,1.0)+")",colorBlue,5 ); 
Plot(Zig(CCI( periods ),PercChangeIncorrect ),"Zig
Incorrect("+WriteVal(PercChangeIncorrect ,1.0)+")",colorBlue,5); 
} 
if (ZigsOnly) 
{ 
Plot(0,"",1,5); 
Plot(Zig(CCIPos,PercChangeCorrect)+CCINegOffset,"\nZig("+WriteVal(PercChange
Correct,1.0)+")",colorRed,5); 
Plot(Zig(CCIPos,PercChangeShifted
),"\nZigShifted("+WriteVal(PercChangeShifted
,1.0)+")",colorGreen,styleLeftAxisScale|5); 
Plot(Zig(CCI( periods ),PercChangeIncorrect ),"\nZig
Incorrect("+WriteVal(PercChangeIncorrect ,1.0)+")",colorBlue,5); 
Plot(CCI( periods ), "\nCCI("+WriteVal(periods,1.0)+")",colorBlack,5 ); 
} 
/*       
//==========Yves corrected version================ 
_SECTION_BEGIN("Z-CCI"); 
ZigsOnly= ParamToggle("ZigsOnly","No|Yes",0); 
PercChange = Param( "PercChange ", 1, 0, 100, 1 ); 
Indic = CCI(21) ; 
YL = IIf(Indic>100,100, //give me the Top }   
IIf(Indic<-100,-100,Indic)); //{give me the Bottom } 
//yl; //{my CCI } 
if (!ZigsOnly)//for testing purposes only 
{ 
Plot(yl, "YL", colorRed); 
//Plot(TroughBars(YL,200)==0,"", colorBlack,styleOwnScale); 
} 
Plot(Zig(YL,PercChange ), "ZigIncorrect", colorBlue); //Incorrect 
Plot(Zig(YL+100,PercChange )-100, "ZigCorrect", colorGreen); //correct 
CCINegOffset=LowestVisibleValue(YL); //For general computation purposes take
LLV(CCI(periods),barcount-1) 
YL=CCI( periods )-CCINegOffset;//Adjusted with min amount necessary to have
non-negative (positive) values 
_SECTION_END(); 
*/ 

/* 
//=======================This version doesn't work======================= 
Indic := CCI(21) ;//error message 
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 ;} 
{//missing bracket, etc.


_____________________________________________
From: Joris Schuller [mailto:jschuller@xxxxxxxxxxx] 
Sent: Sunday, December 13, 2009 2:37 PM
To: 'amibroker@xxxxxxxxxxxxxxx'
Subject: RE: [amibroker] Problem with the ZIG


Try this: Offset the CCi by the LowestVisibleValue of CCI, compute the Zig
and then deduct the LowestVisibleValue again.
//============= with CCI restored to original value
_SECTION_BEGIN("CCI");
periods = Param( "Periods", 14, 2, 200, 1 );
PerChange = Param( "PerChange", 10, 0, 100, 1 );
CCINegOffset=LowestVisibleValue(CCI(Periods));
CCIPos=CCI( periods )-CCINegOffset;//Adjusted with min amount necessary to
habe non-negative values
Plot( CCI( periods ), _DEFAULT_NAME(), ParamColor( "Color",  colorCycle ),
ParamStyle("Style")  );
Plot(Zig(CCIPos,PerChange)+CCINegOffset,"Zig",colorGreen,5);
_SECTION_END();


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf
Of Yves
Sent: Friday, December 11, 2009 2:07 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Problem with the ZIG

  
In this formula below
I'm use a ZIG on CCI Indicator
I'm change the value of the CCI because AB have a problem with 0 or negative
value
My New CCI have a value of 20 to 80
I'm would have a ZIG who's give to me 20 and 80 ONLY.
If I'm use a Zig(YL,70), i'm obtain a ZIG who's change from 20 to 78(It's no
good)
If I'm use a Zig(YL,71), i'm obtain NOTHING
 
WHY?
How can have a ZIG who's give a value of 20 and 80 ONLY
 
Thank
 
YLTech

_SECTION_BEGIN("CCI-MOD");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo
%g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) )
));
// I'm change the value of the CCI because AB have a problem with 0 or
negative value
Indic = ((CCI(14)+200)/5) ;
YL= IIf(Indic>80,80,IIf(Indic<20,20,Indic)) ;
ZYL= Zig(YL,70) ; //ZIG WITH PROBLEM ???????
//I'm have NOTHING IF the ZIG=71 WHY ??????????????????
Plot( YL,"Vague-CCI",colorBlue,styleLine ) ;
Plot( ZYL,"Zig-Vague-CCI",colorBlack,styleLine ) ;
_SECTION_END();

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@xxxxxxxxxxxx



<*>Attachment(s) from Joris Schuller:


<*> 1 of 1 File(s) http://groups.yahoo.com/group/amibroker/attachments/folder/1212526765/item/list 
  <*> winmail.dat

------------------------------------

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

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    amibroker-digest@xxxxxxxxxxxxxxx 
    amibroker-fullfeatured@xxxxxxxxxxxxxxx

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