CCI - Indicator

Vragen en suggesties over handelssystemen en indicatoren

Moderator: Perry

CCI - Indicator

Berichtdoor JPR » za 01 nov 2003, 15:22

Hallo is er iemand hier die een oplossing heeft voor de StandardDev ??? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Feature Poll Description:
For what its worth, I just came up with this indicator that looks just like CCI, except unlike CCI, it's more bounded within the scale that you specify and does not "over react" as the classical CCI. The default scale value of 245 seem to work rather well.

The idea of this indicator is to measure where price is compared to a simple moving average. I display the measured distance from the moving average in terms of the number of standard deviations. As students of statistics know, three standard deviations is 99% of the population, so I map the number of standard deviation onto the scale range by dividing the standard deviation by 3 and multiplying it by the scale, just to make it easier for those who are used to seeing CCI oscillating in between that range.

In the following chart, the indicator has been applied three times to the same subgraph 2, one as length 6, color red with the horizontal lines at 100, twice as length 14, color yellow, one as histogram and one as thick line, with the horizontal lines set at 100 and 200, just for variations.

Similarly, the classical CCI is in subgraph 3, just for your comparison. Subgraph 1 is price plus Bollinger Bands of length 14 and 2 standard deviations.

Code for indicator:

input:
? Price ? ?((h+l+c)/3),
? Length ? (14),
? Scale ? ?(245),
? LineUpper(100),
? LineLower(-100);

plot1(eKamCCI(Price,Length,Scale),"eKamCCI");
plot2(LineUpper,"Upper");
plot3(LineLower,"Lower");
plot4(0,"0");

{ Alert criteria }
if ? ? ?Plot1 crosses over ?LineLower then
? Alert( "CCI crosses over " + NumToStr(LineLower,0) )
else if Plot1 crosses under LineLower then
? Alert( "CCI crosses under " + NumToStr(LineLower,0) )
else if Plot1 crosses over ?LineUpper then
? Alert( "CCI crosses over " + NumToStr(LineUpper,0) )
else if Plot1 crosses under LineUpper then
? Alert( "CCI crosses under " + NumToStr(LineUpper,0) )
else if Plot1 crosses over 0 then
? Alert( "CCI crosses over zero" )
else if Plot1 crosses under 0 then
? Alert( "CCI crosses under zero" );

Code for Function:

input:
? Price (NumericSeries),
? Length(NumericSimple),
? Scale (NumericSimple);
var:
? Sdv(0);

Sdv = StandardDev( Price, Length, 1 );
if Sdv = 0 then
? eKamCCI = eKamCCI[1]
else
? eKamCCI = ( (Price - AverageFC( Price, Length )) / Sdv ) / 3 * scale; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
JPR
 
Berichten: 85
Geregistreerd op: wo 03 jul 2002, 18:39

CCI

Berichtdoor Paul M » za 01 nov 2003, 16:13

inputs:
Price( numericseries ),
Length( numericsimple ),
DataType( numericsimple ) ; { pass in 1 if you are working with the entire
population, and 2 if you are working with a sample and want the Variance for the
population }

variables:
Divisor( 0 ),
SumSqr( 0 ),
Mean( 0 ) ;

StandardDev = 0 ;
Divisor = Iff( DataType = 1, Length, Length - 1 ) ;
if Divisor > 0 then
begin
Mean = Average( Price, Length ) ;
SumSqr = 0 ;
for Value1 = 0 to Length - 1
begin
SumSqr = SumSqr + Square( Price[Value1] - Mean ) ;
end ;
StandardDev = SquareRoot( SumSqr / Divisor );
end ;

Groeten Paul

(Edited by Paul M at 4:14 pm op 1,nov. 2003)


(Edited by Paul M at 4:14 pm op 1,nov. 2003)
Paul M
 
Berichten: 263
Geregistreerd op: vr 13 dec 2002, 23:21

CCI

Berichtdoor JPR » za 01 nov 2003, 17:04

Er zaten nog een paar foutjes in die ik er uit heb gehaald..... maar de indicator zelf werkt nog niet deze verwacht in regel 8 een nummerieke expressie... ?

inputs:
Price( numericseries ),
Length( numericsimple ),
DataType( numericsimple ) ; { pass in 1 if you are working with the entire
population, and 2 if you are working with a sample and want the Variance for the
population }

variables:
Divisor( 0 ),
SumSqr( 0 ),
Mean( 0 ) ,
StandardDev ( 0 ) ;

Divisor = Iff( DataType = 1, Length, Length - 1 ) ;
if Divisor > 0 then
begin
Mean = Average( Price, Length ) ;
SumSqr = 0 ;
for Value1 = 0 to Length - 1
begin
SumSqr = SumSqr + Square( Price[Value1] - Mean ) ;
end ;
StandardDev = SquareRoot( SumSqr / Divisor );
end ;


(Edited by JPR at 5:05 pm op 1,nov. 2003)


(Edited by JPR at 5:07 pm op 1,nov. 2003)
JPR
 
Berichten: 85
Geregistreerd op: wo 03 jul 2002, 18:39

CCI

Berichtdoor Paul M » za 01 nov 2003, 20:04

Functie:

input:
? Price (NumericSeries),
? Length(NumericSimple),
? Scale (NumericSimple);
var:
? Sdv(0);

Sdv = zeStandardDev( Price, Length, 1 );
if Sdv = 0 then
? zeKamCCI = zeKamCCI[1]
else
? value1=xAverage( Price, Length );
? value2=Price -value1;
? zeKamCCI = ( (Price - xAverage( Price, Length )) / Sdv ) / 3 * scale;
end;

Functie:


Price( numericseries ),
Length( numericsimple ),
DataType( numericsimple ) ; { pass in 1 if you are working with the entire
population, and 2 if you are working with a sample and want the Variance for the
population }

variables:
Divisor( 0 ),
SumSqr( 0 ),
Mean( 0 ) ;

zeStandardDev = 0 ;
Divisor = Iff( DataType = 1, Length, Length - 1 ) ;
if Divisor > 0 then
begin
Mean = Average( Price, Length ) ;
SumSqr = 0 ;
for Value1 = 0 to Length - 1
begin
SumSqr = SumSqr + Square( Price[Value1] - Mean ) ;
end ;
zeStandardDev = SquareRoot( SumSqr / Divisor );
end ;

Indicator:

input:
? Length ? (14),
? Scale ? ?(245),
? LineUpper(100),
? LineLower(-100);
vars:Price(0);
Price=(h+l+c)/3;
plot1(zeKamCCI(Price,Length,Scale),"eKamCCI");
plot2(LineUpper,"Upper");
plot3(LineLower,"Lower");
plot4(0,"0");
end;

Paul.
Paul M
 
Berichten: 263
Geregistreerd op: vr 13 dec 2002, 23:21

CCI

Berichtdoor JPR » za 01 nov 2003, 21:12

Paul ik ondervind nog ?problemen heb je dit zelf getest?


Functie: zeKamCCI

input:
? Price (NumericSeries),
? Length(NumericSimple),
? Scale (NumericSimple);
var:
? Sdv(0);

Sdv = zeStandardDev( Price, Length, 1 );
if Sdv = 0 then
? zeKamCCI = zeKamCCI[1]
else
? value1=xAverage( Price, Length );
? value2=Price -value1;
? zeKamCCI = ( (Price - xAverage( Price, Length )) / Sdv ) / 3 * scale;
end;

Functie: zeStandardDev

Price( numericseries ),
Length( numericsimple ),
DataType( numericsimple ) ; { pass in 1 if you are working with the entire
population, and 2 if you are working with a sample and want the Variance for the
population }

variables:
Divisor( 0 ),
SumSqr( 0 ),
Mean( 0 ) ;

zeStandardDev = 0 ;
Divisor = Iff( DataType = 1, Length, Length - 1 ) ;
if Divisor > 0 then
begin
Mean = Average( Price, Length ) ;
SumSqr = 0 ;
for Value1 = 0 to Length - 1
begin
SumSqr = SumSqr + Square( Price[Value1] - Mean ) ;
end ;
zeStandardDev = SquareRoot( SumSqr / Divisor );
end ;

Indicator: zeKamCCI

input:
? Length ? (14),
? Scale ? ?(245),
? LineUpper(100),
? LineLower(-100);
vars:Price(0);
Price=(h+l+c)/3;
plot1(zeKamCCI(Price,Length,Scale),"eKamCCI");
plot2(LineUpper,"Upper");
plot3(LineLower,"Lower");
plot4(0,"0");
end;
JPR
 
Berichten: 85
Geregistreerd op: wo 03 jul 2002, 18:39

CCI

Berichtdoor Paul M » za 01 nov 2003, 21:56

Ja, bij mij werkt dit.

Paul.
Paul M
 
Berichten: 263
Geregistreerd op: vr 13 dec 2002, 23:21

CCI

Berichtdoor JPR » zo 02 nov 2003, 14:10

Paul, ik snap het nog niet helemaal de onderstaande functie geeft de volgende foutmelding: fout in regel 1 positie 6 fout -37 ?Verwacht hier een "is gelijk teken" ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Functie: zeStandardDev

Price( numericseries ),
Length( numericsimple ),
DataType( numericsimple ) ; { pass in 1 if you are working with the entire
population, and 2 if you are working with a sample and want the Variance for the
population }

variables:
Divisor( 0 ),
SumSqr( 0 ),
Mean( 0 ) ;

zeStandardDev = 0 ;
Divisor = Iff( DataType = 1, Length, Length - 1 ) ;
if Divisor > 0 then
begin
Mean = Average( Price, Length ) ;
SumSqr = 0 ;
for Value1 = 0 to Length - 1
begin
SumSqr = SumSqr + Square( Price[Value1] - Mean ) ;
end ;
zeStandardDev = SquareRoot( SumSqr / Divisor );
end ;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
Functie: zeKamCCI

De functie zeKamCCI geeft de foutmelding: fout in regel 8 pos 20 fout -51 Variabele type fout verwacht value is Onbekend ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
input:
?Price (NumericSeries),
?Length(NumericSimple),
?Scale (NumericSimple);
var:
?Sdv(0);

Sdv = zeStandardDev( Price, Length, 1 );
if Sdv = 0 then
?zeKamCCI = zeKamCCI[1]
else
?value1=xAverage( Price, Length );
?value2=Price -value1;
?zeKamCCI = ( (Price - xAverage( Price, Length )) / Sdv ) / 3 * scale;
end;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Indicator: zeKamCCI

De indicator geeft de volgende foutmelding: fout in regel 8 pos 35 fout - 57 Verwacht hier een nummerieke expressie ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

input:
?Length ? (14),
?Scale ? ?(245),
?LineUpper(100),
?LineLower(-100);
vars:Price(0);
Price=(h+l+c)/3;
plot1(zeKamCCI(Price,Length,Scale),"eKamCCI";
plot2(LineUpper,"Upper";
plot3(LineLower,"Lower";
plot4(0,"0";
end; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
Functie en indicator mogen toch de zelfde naam hebben?
JPR
 
Berichten: 85
Geregistreerd op: wo 03 jul 2002, 18:39

CCI

Berichtdoor Paul M » zo 02 nov 2003, 15:04

Paul,

Bij zeStandardDev. ontbreekt het woord input.
Altijd een kopie maken via edit.

Paul.
Paul M
 
Berichten: 263
Geregistreerd op: vr 13 dec 2002, 23:21

CCI

Berichtdoor JPR » ma 03 nov 2003, 0:06

:shocked: ? :shocked: ? :shocked: ? :shocked: ? :shocked::shocked: ? :shocked: ? :shocked: ? :shocked: ? :shocked:? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Ik had mijn leesbril niet op.......... wel lastig knippen en plakken hier in het forum........
JPR
 
Berichten: 85
Geregistreerd op: wo 03 jul 2002, 18:39

CCI

Berichtdoor JPR » do 11 dec 2003, 22:29

Hallo Paul M, ik ben onder de indruk van deze indicator ik weet niet of je hem hebt opgebouwd zoals eKam het heeft beschreven m.b.t. de grafiek... ?de crossings van de eKamCCI6 en 10 in het OB en OS in relatie met de bollingerband geven mooie signalen op de AEX. Hier moet toch een mooi handelssyteempje van te maken zijn....
JPR
 
Berichten: 85
Geregistreerd op: wo 03 jul 2002, 18:39

CCI

Berichtdoor JPR » za 13 dec 2003, 12:51

Voor de liefhebber nog eens de handels signalen......... ? Het moet toch mogelijk zijn om de siganlen van de CCI 14 en CCI 6 te combineren? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? input:
? Price ? ?((h+l+c)/3),
? Length ? (14),
? Scale ? ?(245),
? LineUpper(100),
? LineLower(-100);

plot1(eKamCCI(Price,Length,Scale),"eKamCCI");
plot2(LineUpper,"Upper");
plot3(LineLower,"Lower");
plot4(0,"0");

{ Alert criteria }
if ? ? ?Plot1 crosses over ?LineLower then
? Alert( "CCI crosses over " + NumToStr(LineLower,0) )
else if Plot1 crosses under LineLower then
? Alert( "CCI crosses under " + NumToStr(LineLower,0) )
else if Plot1 crosses over ?LineUpper then
? Alert( "CCI crosses over " + NumToStr(LineUpper,0) )
else if Plot1 crosses under LineUpper then
? Alert( "CCI crosses under " + NumToStr(LineUpper,0) )
else if Plot1 crosses over 0 then
? Alert( "CCI crosses over zero" )
else if Plot1 crosses under 0 then
? Alert( "CCI crosses under zero" );

(Edited by JPR at 1:02 pm op 13,dec. 2003)
JPR
 
Berichten: 85
Geregistreerd op: wo 03 jul 2002, 18:39


Keer terug naar Handelssystemen + Indicatoren

Wie is er online

Gebruikers op dit forum: Geen geregistreerde gebruikers en 20 gasten

cron