Where is the error?

Questions about MultiCharts and user contributed studies.
arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Where is the error?

Postby arjfca » 18 Jun 2012

Just can't figure why it give a compilation error
The code is for the creation of 10 Trend Line. The value to be put in an array

Copy section of my code. Compilation stopped at the "For" loop beginning

Code: Select all

Array:
Intrabarpersist LineHigh[10](0),
Intrabarpersist LineLow[10] (0);

Var:
intrabarpersist CD (0), //Counter day
Intrabarpersist StringHigh (""),
intrabarpersist StringLow ("");

once If barnumber =1 then begin
CD = 1;
For CD = 1 to 10 begin
LineHigh(CD) = TL_New_s (Date, Time_s,0, Date, Time_s, 0);
LineLow(CD) = TL_New_s (Date, Time_s,0, Date, Time_s, 0);
CD = CD +1;
End;
End;

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Where is the error?

Postby TJ » 18 Jun 2012

Just can't figure why it give a compilation error
The code is for the creation of 10 Trend Line. The value to be put in an array

Copy section of my code. Compilation stopped at the "For" loop beginning

Code: Select all

Array:
Intrabarpersist LineHigh[10](0),
Intrabarpersist LineLow[10] (0);

Var:
intrabarpersist CD (0), //Counter day
Intrabarpersist StringHigh (""),
intrabarpersist StringLow ("");

once If barnumber =1 then begin
CD = 1;
For CD = 1 to 10 begin
LineHigh(CD) = TL_New_s (Date, Time_s,0, Date, Time_s, 0);
LineLow(CD) = TL_New_s (Date, Time_s,0, Date, Time_s, 0);
CD = CD +1;
End;
End;

you have to watch your brackets:

LineHigh[CD]


note square bracket

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Where is the error?

Postby TJ » 18 Jun 2012

ps:

this line

Code: Select all

once If barnumber =1 then begin
could be written as this:

Code: Select all

once begin

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Where is the error?

Postby TJ » 18 Jun 2012

re your snippet

Code: Select all

For CD = 1 to 10 begin
LineHigh(CD) = TL_New_s (Date, Time_s,0, Date, Time_s, 0);
LineLow(CD) = TL_New_s (Date, Time_s,0, Date, Time_s, 0);
CD = CD +1;
End;

this line is not needed

Code: Select all

CD = CD +1;
it should be written as:

Code: Select all

For CD = 1 to 10 begin
LineHigh[CD] = TL_New_s (Date, Time_s,0, Date, Time_s, 0);
LineLow[CD] = TL_New_s (Date, Time_s,0, Date, Time_s, 0);

End;

Why do you need CD as intrabarpersist ?

arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Re: Where is the error?

Postby arjfca » 18 Jun 2012

Removed CD = CD +1

Why do I need CD in IntraBarpersist, I will reference it later in the code. Not sure if need to be IntraBarPersist, Will test when routine do work

The purpose of the routine is to gather and keep the high and low of the last 10 days in a string then display them.

Price do react to the last High and low of previous periods so I want to see what was those values

Martin :)


Return to “MultiCharts”