woodies cci

#1
I want woodies CCI in metastock can any one please help i have infact found a formulae on web that says this is woodies cci but im not ben able to fit it in metastock so it appears like actual woodies cci as been seen in amibroker or say advanced get , for your ref im copy pasting that formulae here any one who can help i "ll be happy and be thankfull from heart

Regards

Bunty

formulae for woodies cci

The following code builds custom indicators in Metastock Pro. Simply copy between the dotted lines. Go to Tools/Indicator Builder/New. Paste in formula section and name the function. The indicators will return +1 value when a signal is generated. Tested with Metastock Pro 9.1 should work on any Metastock version 6.52 or higher.

The Momentum Reversals will trigger with the trend or the grey CCI bar equivalent in the e-signal template. For example MR Sell with trend will trigger until there are 6 or more CCI bars above the zero line which establishes a bullish CCI trend.

Hope this helps, use at your own risk.


ZLR Sell no sidewinder
------8<-----------------------------------
{Woodies Basic ZLR Sell Rules for Metastock}
{for personal use only}
{choose number of CCI periods between 2 and 21, 14 is default}
pds:=Input("CCI periods",2,21,14);

{standard ZLR Rules i.e.: last 6 CCI bars below the zero line, current bar is less than previous bar and the current cci bar is greater than -130}
CCI(pds)>-130 AND
CCI(pds)<Ref(CCI(pds),-1) AND
Ref(CCI(pds),-1)> Ref(CCI(pds),-2 )AND
Sum(CCI(pds)<0,6)=6 AND
Ref(CCI(pds),-1)> -100
------8<-----------------------------------


ZLR Buy no sidewinder
------8<-----------------------------------
{Woodies Basic ZLR Buy Rules for Metastock}
{for personal use only}
{choose number of CCI periods between 2 and 21, 14 is default}
pds:=Input("CCI periods",2,21,14);

{standard ZLR Rules i.e.: last 6 CCI bars above the zero line, current bar is less than previous bar and the current cci bar is less than 130}
CCI(pds)<130 AND
CCI(pds)>Ref(CCI(pds),-1) AND
Ref(CCI(pds),-1)< Ref(CCI(pds),-2) AND
Sum(CCI(pds)>0,6)=6 AND
Ref(CCI(pds),-1)< 100
------8<-----------------------------------



Momentum Reversal Buy with Trend
------8<-----------------------------------
{CCI Basic Momentum Reversal Buy Rules with Trend
for Metastock}
{for personal use only}

{choose number of CCI periods between 2 and 21, 14 is default}
pds:=Input("CCI periods",2,21,14);
x:=Sum(CCI(pds)<0,6)=6;
CCI(pds)>Ref(CCI(pds),-1)AND
Ref(CCI(pds),-1)< Ref(CCI(pds),-2)AND
Ref(CCI(pds),-2)< Ref(CCI(pds),-3)AND
x=0
------8<-----------------------------------


Momentum Reversal Sell with Trend
------8<-----------------------------------
{CCI Basic Momentum Reversal Sell Rules with Trend
for Metastock}
{for personal use only}

{choose number of CCI periods between 2 and 21, 14 is default}
pds:=Input("CCI periods",2,21,14);
x:=Sum(CCI(pds)>0,6)=6;
CCI(pds)<Ref(CCI(pds),-1)AND
Ref(CCI(pds),-1)> Ref(CCI(pds),-2)AND
Ref(CCI(pds),-2)> Ref(CCI(pds),-3)AND
x=0
------8<-----------------------------------


Divergence Setup - useful for developing indicators based on divers, and reverse divers
------8<-----------------------------------
{ Class A price/indicator divergence v4 }
{ +1 signal = bullish trough divergences }
{ -1 signal = bearish peak divergences }
{ Copyright 2004 Jose Silva }
{ modified for CCI by cn001532 }
{ For personal use only }
{ nonewww.metastocktools.com }

{User inputs }
pds:=Input("Indicator periods",2,50,14);

{divergence indicator }
y:=CCI(pds);

{ Price peaks/troughs }
Pkx:=C<Ref(C,-1) AND Ref(C,-1)>Ref(C,-2)
AND Ref(C,-1)>=(C+Ref(C,-2))/2;
Pkx1:=ValueWhen(1,Pkx,Ref(C,-1));
Pkx2:=ValueWhen(2,Pkx,Ref(C,-1));
Trx:=C>Ref(C,-1) AND Ref(C,-1)<Ref(C,-2)
AND Ref(C,-1)<=(C+Ref(C,-2))/2;
Trx1:=ValueWhen(1,Trx,Ref(C,-1));
Trx2:=ValueWhen(2,Trx,Ref(C,-1));

{ Indicator peaks/troughs }
Pky:=y<Ref(y,-1) AND Ref(y,-1)>Ref(y,-2)
AND Ref(y,-1)>=(y+Ref(y,-2))/2;
Pky1:=ValueWhen(1,Pky,Ref(y,-1));
Pky2:=ValueWhen(2,Pky,Ref(y,-1));
Try:=y>Ref(y,-1) AND Ref(y,-1)<Ref(y,-2)
AND Ref(y,-1)<=(y+Ref(y,-2))/2;
Try1:=ValueWhen(1,Try,Ref(y,-1));
Try2:=ValueWhen(2,Try,Ref(y,-1));

{ Plot signals }
(Trx AND Try AND Trx1<Trx2
AND Try1>Try2)
-(Pkx AND Pky AND Pkx1>Pkx2
AND Pky1<Pky2)
------8<-----------------------------------

The following code calculates the slope of the 34 ema. This figure does not match the 34 EMA in degrees that we are used to seeing in other Woodie CCI templates but experiment with some values of the slope and you can approximate a "30 degree" angle.

EMA Slope calculation
-----8<-------------------------------------------------------------------

EMA:=Mov(C,34,E);
EMAprev:=Ref(EMA,-1);

y:=Min(EMA,EMAprev)/Max(EMA,EMAprev);
EMAratio:=(If(EMA>EMAprev,2-y,y)-1)*100;
EMAdeg:=If(EMAratio<0,Atan(EMAratio,1)-360,
Atan(EMAratio,1)){*10/9}; {<-remove brackets for 0~100% values}

EMAdeg
-----8<-------------------------------------------------------------------


Metastock Pro already has a predefined CCI function. But for those purists who have to see the CCI standard formula expressed in Metastock:
-----8<-------------------------------------------------------------------
{CCI-STD cs}
{written by Corey Saxe}
V1:=Input("Periods",2,250,14);
x:=Typical();
y:=Mov(x,V1,S);
z:=Sum(Abs(x-LastValue(y+PREV-PREV)),V1)/V1;
A1:=z*0.015;
ZZI:=(x-y)/A1;
ZZI{end}
-----8<-------------------------------------------------------------------
 

rkkarnani

Well-Known Member
#2
I want woodies CCI in metastock can any one please help i have infact found a formulae on web that says this is woodies cci but im not ben able to fit it in metastock so it appears like actual woodies cci as been seen in amibroker or say advanced get , for your ref im copy pasting that formulae here any one who can help i "ll be happy and be thankfull from heart

Regards

Bunty

formulae for woodies cci

The following code builds custom indicators in Metastock Pro. Simply copy between the dotted lines. Go to Tools/Indicator Builder/New. Paste in formula section and name the function. The indicators will return +1 value when a signal is generated. Tested with Metastock Pro 9.1 should work on any Metastock version 6.52 or higher.

The Momentum Reversals will trigger with the trend or the grey CCI bar equivalent in the e-signal template. For example MR Sell with trend will trigger until there are 6 or more CCI bars above the zero line which establishes a bullish CCI trend.

Hope this helps, use at your own risk.


ZLR Sell no sidewinder
------8<-----------------------------------
{Woodies Basic ZLR Sell Rules for Metastock}
{for personal use only}
{choose number of CCI periods between 2 and 21, 14 is default}
pds:=Input("CCI periods",2,21,14);

{standard ZLR Rules i.e.: last 6 CCI bars below the zero line, current bar is less than previous bar and the current cci bar is greater than -130}
CCI(pds)>-130 AND
CCI(pds)<Ref(CCI(pds),-1) AND
Ref(CCI(pds),-1)> Ref(CCI(pds),-2 )AND
Sum(CCI(pds)<0,6)=6 AND
Ref(CCI(pds),-1)> -100
------8<-----------------------------------


ZLR Buy no sidewinder
------8<-----------------------------------
{Woodies Basic ZLR Buy Rules for Metastock}
{for personal use only}
{choose number of CCI periods between 2 and 21, 14 is default}
pds:=Input("CCI periods",2,21,14);

{standard ZLR Rules i.e.: last 6 CCI bars above the zero line, current bar is less than previous bar and the current cci bar is less than 130}
CCI(pds)<130 AND
CCI(pds)>Ref(CCI(pds),-1) AND
Ref(CCI(pds),-1)< Ref(CCI(pds),-2) AND
Sum(CCI(pds)>0,6)=6 AND
Ref(CCI(pds),-1)< 100
------8<-----------------------------------



Momentum Reversal Buy with Trend
------8<-----------------------------------
{CCI Basic Momentum Reversal Buy Rules with Trend
for Metastock}
{for personal use only}

{choose number of CCI periods between 2 and 21, 14 is default}
pds:=Input("CCI periods",2,21,14);
x:=Sum(CCI(pds)<0,6)=6;
CCI(pds)>Ref(CCI(pds),-1)AND
Ref(CCI(pds),-1)< Ref(CCI(pds),-2)AND
Ref(CCI(pds),-2)< Ref(CCI(pds),-3)AND
x=0
------8<-----------------------------------


Momentum Reversal Sell with Trend
------8<-----------------------------------
{CCI Basic Momentum Reversal Sell Rules with Trend
for Metastock}
{for personal use only}

{choose number of CCI periods between 2 and 21, 14 is default}
pds:=Input("CCI periods",2,21,14);
x:=Sum(CCI(pds)>0,6)=6;
CCI(pds)<Ref(CCI(pds),-1)AND
Ref(CCI(pds),-1)> Ref(CCI(pds),-2)AND
Ref(CCI(pds),-2)> Ref(CCI(pds),-3)AND
x=0
------8<-----------------------------------


Divergence Setup - useful for developing indicators based on divers, and reverse divers
------8<-----------------------------------
{ Class A price/indicator divergence v4 }
{ +1 signal = bullish trough divergences }
{ -1 signal = bearish peak divergences }
{ Copyright 2004 Jose Silva }
{ modified for CCI by cn001532 }
{ For personal use only }
{ nonewww.metastocktools.com }

{User inputs }
pds:=Input("Indicator periods",2,50,14);

{divergence indicator }
y:=CCI(pds);

{ Price peaks/troughs }
Pkx:=C<Ref(C,-1) AND Ref(C,-1)>Ref(C,-2)
AND Ref(C,-1)>=(C+Ref(C,-2))/2;
Pkx1:=ValueWhen(1,Pkx,Ref(C,-1));
Pkx2:=ValueWhen(2,Pkx,Ref(C,-1));
Trx:=C>Ref(C,-1) AND Ref(C,-1)<Ref(C,-2)
AND Ref(C,-1)<=(C+Ref(C,-2))/2;
Trx1:=ValueWhen(1,Trx,Ref(C,-1));
Trx2:=ValueWhen(2,Trx,Ref(C,-1));

{ Indicator peaks/troughs }
Pky:=y<Ref(y,-1) AND Ref(y,-1)>Ref(y,-2)
AND Ref(y,-1)>=(y+Ref(y,-2))/2;
Pky1:=ValueWhen(1,Pky,Ref(y,-1));
Pky2:=ValueWhen(2,Pky,Ref(y,-1));
Try:=y>Ref(y,-1) AND Ref(y,-1)<Ref(y,-2)
AND Ref(y,-1)<=(y+Ref(y,-2))/2;
Try1:=ValueWhen(1,Try,Ref(y,-1));
Try2:=ValueWhen(2,Try,Ref(y,-1));

{ Plot signals }
(Trx AND Try AND Trx1<Trx2
AND Try1>Try2)
-(Pkx AND Pky AND Pkx1>Pkx2
AND Pky1<Pky2)
------8<-----------------------------------

The following code calculates the slope of the 34 ema. This figure does not match the 34 EMA in degrees that we are used to seeing in other Woodie CCI templates but experiment with some values of the slope and you can approximate a "30 degree" angle.

EMA Slope calculation
-----8<-------------------------------------------------------------------

EMA:=Mov(C,34,E);
EMAprev:=Ref(EMA,-1);

y:=Min(EMA,EMAprev)/Max(EMA,EMAprev);
EMAratio:=(If(EMA>EMAprev,2-y,y)-1)*100;
EMAdeg:=If(EMAratio<0,Atan(EMAratio,1)-360,
Atan(EMAratio,1)){*10/9}; {<-remove brackets for 0~100% values}

EMAdeg
-----8<-------------------------------------------------------------------


Metastock Pro already has a predefined CCI function. But for those purists who have to see the CCI standard formula expressed in Metastock:
-----8<-------------------------------------------------------------------
{CCI-STD cs}
{written by Corey Saxe}
V1:=Input("Periods",2,250,14);
x:=Typical();
y:=Mov(x,V1,S);
z:=Sum(Abs(x-LastValue(y+PREV-PREV)),V1)/V1;
A1:=z*0.015;
ZZI:=(x-y)/A1;
ZZI{end}
-----8<-------------------------------------------------------------------
How does it look on charts in Metastock? Is it giving Buy Sell Signals in Metastock? If answer to both is in affirmative, than what Help are you seeking?
 

Similar threads