HighPass

Posted By: YG8

HighPass - 07/23/20 08:11

Tried to copy paste the script from the indicators file

{
alpha1 = (Cosine(.707*360 / 48) + Sine (.707*360 / 48) - 1) / Cosine(.707*360 / 48);
HP = (1 - alpha1 / 2)*(1 - alpha1 / 2)*(Close - 2*Close[1] + Close[2]) + 2*(1 - alpha1)*HP[1] - (1 - alpha1)*(1 - alpha1)*HP[2];
if(!CutoffPeriod) CutoffPeriod = 48;
var a = (0.707*2*PI)/CutoffPeriod;
var alpha1 = 1.+(sin(a)-1.)/cos(a);
var b = 1.-alpha1/2.;
var c = 1.-alpha1;

var* HP = series(0,3);
SETSERIES(Data,0);
return HP[0] = b*b*(Data[0]-2*Data[1]+Data[2])
+2*c*HP[1]
-c*c*HP[2];
}

But i get following message

Zorro HighPass -stay


HighPass compiling......
Error in 'line 3:
'alpha1' undeclared identifier
< alpha1 = (Cosine(.707*360 / 48) + Sine (.707*360 / 48) - 1) / Cosine(.707*360 / 48);
>.

HighPass compiling.......
Error in 'line 5:
'alpha1' undeclared identifier
< alpha1 = (Cosine(.707*360 / 48) + Sine (.707*360 / 48) - 1) / Cosine(.707*360 / 48);
>.


How do i make the alpha1 declared?
Posted By: ron17

Re: HighPass - 07/23/20 18:57

Your code has other syntax issues too, like Close, etc.
Can you share the entire script ?.
Posted By: Qw3rty

Re: HighPass - 07/24/20 08:03

You can't just copy code out of context and run it especially indicator code.

You need to use the functions in Zorro which relate to the indicator code. What you are using seems to be a filter:
https://manual.zorro-project.com/filter.htm
https://manual.zorro-project.com/tutorial_lowpass.htm
© 2024 lite-C Forums