| |
|
|
Function :
StandardDev
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 ;
|
Function :
eKamCCI
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;
|
Indicator: eKam
CCI
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" );
|
|
 |
 |
|
| |
|