compilation failure

Questions about MultiCharts and user contributed studies.
fundjunkie
Posts: 58
Joined: 25 Sep 2005
Location: UK

compilation failure

Postby fundjunkie » 04 Sep 2007

Hi,
Can someone tell me why this code won't compile? The error given by PL Editor is too cryptic to be of much help:

Inputs:
Price((H+L)/2);
N(16);

Vars:
Count(0);
N1(0);
N2(0);
N3(0);
NH(0);
NL(0);
HH(0);
LL(0);
Dimen(0);
alpha(0);
Filt(0);

N3 = (Highest(High,16) - Lowest(Low,16))/16;

HH = High;
LL= Low;

For Count = 0 to N/2 - 1 begin
If High[Count] > HH then HH = High[count];
IfLow[Count] < LL then LL = Low[count];
End;

N1 = (HH - LL)/(N/2);

HH = High[N/2];
LL = Low[N/2];

For count = N/2 to N - 1 begin
If High[Count] > HH then HH = High[Count];
If Low[Count] < LL then LL = Low[count];
End;

N2 = (HH - LL)/(N/2);

If N1 > 0 and N2 > 0 and N3 > 0 then Dimen = (Log(N1 + N2) - Log(N3))/Log(2);

alpha = ExpValue(-4.6*(Dimen - 1));

If alpha < .01 then alpha = .01;
If alpha > 1 then alpha = 1;

Filt = alpha*Price + (1 - alpha)*Filt[1];

If CurrentBar < N + 1 then Filt = Price;

Plot1(Filt);


Thx
D

User avatar
ABC
Posts: 718
Joined: 16 Dec 2006
Location: www.abctradinggroup.com
Has thanked: 125 times
Been thanked: 408 times
Contact:

Postby ABC » 04 Sep 2007

fundjunkie,

PL Editor is complaining about the variables and inputs being initialized wrong. All Variable or Input have to be comma separated and not with semicolons. If you want to use semicolons for each variable, you'll have to use the reserved word "Variable" before every of your variables.
So change the first part to this:

Code: Select all

Inputs:
Price((H+L)/2),
N(16);

Vars:
Count(0),
N1(0),
N2(0),
N3(0),
NH(0),
NL(0),
HH(0),
LL(0),
Dimen(0),
alpha(0),
Filt(0);
The second thing is only a typo:
IfLow[Count] < LL then LL = Low[count];

should be changed to If Low[Count].....

After changing this your code will compile.

Best regards,

ABC


Return to “MultiCharts”