Help with code????

Rossini

Established member
Messages
916
Likes
132
Can anyone help me with getting this indicator to work? Im using TS 8.8 and when I compile the indicator it keeps saying ''word not recognised in easy language''

Here is the code any help is greatly appreciated!!

Type : Function, Name : 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 ;





Type : Function, Name : 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;





Type : Indicator, Name : 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" );
 
Can anyone help me with getting this indicator to work? Im using TS 8.8 and when I compile the indicator it keeps saying ''word not recognised in easy language''

Here is the code any help is greatly appreciated!!

Type : Function, Name : 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 ;





Type : Function, Name : 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;





Type : Indicator, Name : 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" );

Does it say which word or what line it is on?

Brad
 
Does it say which word or what line it is on?

Brad

Hey brad,

It says errors on lines 4, 5, 6, 35 and 54 (numeric expression expected here). It has warnings on lines 35 and 54 (price is an input redefinition)

I have no idea what the above means btw...

Thanks for looking.
 
So if the errors are there, then it seems to be having a problem with the numericseries, numericsample commands.

I don't use this, so are they standard commands that require an argument i.e. if I wanted an average of 10 points I would write average(10) with 10 being the argument ?

What is the start and end of the series you're referrgin to
 
Type : Function, Name : 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 }

You have "inputs" here and just "input" elsewhere. One, most likely the first one since that's the line referred to in your error, is incorrect.

I don't use TS, but the error most likely refers to a syntax problem if this isn't it. Syntax errors will cause a cascade of other phantom errors that disappear when the syntax is corrected.

Peter
 
Last edited:
Can anyone help me with getting this indicator to work? Im using TS 8.8 and when I compile the indicator it keeps saying ''word not recognised in easy language''

Here is the code any help is greatly appreciated!!

Type : Function, Name : 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 ;





Type : Function, Name : 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;





Type : Indicator, Name : 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" );


there are 3 sets of codes here,
2 funcitons and 1 indicator.
you have to compile them separately
 
Hi,

The standardDev function is an Tradestation inbuilt function and I have attached the ekamCCI function and ekam CCI indicator here.
You can just import the eld's.

Hope this will help you..
Cheers,
MGN
 

Attachments

  • EKAMCCI_FUNCTION.ELD
    2.5 KB · Views: 498
  • EKAM CCI_Indicator.ELD
    5.3 KB · Views: 522
Top