Is there any way I can reset an array to zero without having to do it for every indicitdual cell? For example.
Array: array1[1,1]
if condition1 then begin
array[0,0]=0;
array[1,0]=0;
array[1,0]=0;
array[1,1]=0;
end;
This is fine fo this array because it is small but If I have an array that is 20x20, this is very time consuming. Is there a way I can set the whole thing to zero without having to set them all to zero individually?
Setting array = 0
- Marina Pashkova
- Posts: 2758
- Joined: 27 Jul 2007
-
- Posts: 50
- Joined: 11 Nov 2005
- Contact:
Thanks so much for your help. Ok, this is what I have so far.
Array: SetT[8,3];
Var: _i(0);
Var: _j(0);
If condition1 then begin
For _i=0 to 8 begin
For _j=0 to 3 begin
SetT[_i, _j]=3;
end;
end;
end;
I'm getting an error that read "equal sign '=' expected" and the cursor stops right at the line "For _i=0 to 8 begin" on the underscore "_" Am I missing something? Also, what does the =3 designate?
Array: SetT[8,3];
Var: _i(0);
Var: _j(0);
If condition1 then begin
For _i=0 to 8 begin
For _j=0 to 3 begin
SetT[_i, _j]=3;
end;
end;
end;
I'm getting an error that read "equal sign '=' expected" and the cursor stops right at the line "For _i=0 to 8 begin" on the underscore "_" Am I missing something? Also, what does the =3 designate?
This code is the equivalent to setting each element to zero. It would be good if they provided built in funtions that were optimized, to zero and array or set it to any value. That aside , You did not define condition1 . It may be looking for condition1 "=" to something in the if, then statement.
~J
[quote]Thanks so much for your help. Ok, this is what I have so far.
Array: SetT[8,3];
Var: _i(0);
Var: _j(0);
If condition1 then begin
For _i=0 to 8 begin
For _j=0 to 3 begin
SetT[_i, _j]=3;
end;
end;
end;
I'm getting an error that read "equal sign '=' expected" and the cursor stops right at the line "For _i=0 to 8 begin" on the underscore "_" Am I missing something? Also, what does the =3 designate?[/quote]
~J
[quote]Thanks so much for your help. Ok, this is what I have so far.
Array: SetT[8,3];
Var: _i(0);
Var: _j(0);
If condition1 then begin
For _i=0 to 8 begin
For _j=0 to 3 begin
SetT[_i, _j]=3;
end;
end;
end;
I'm getting an error that read "equal sign '=' expected" and the cursor stops right at the line "For _i=0 to 8 begin" on the underscore "_" Am I missing something? Also, what does the =3 designate?[/quote]
-
- Posts: 50
- Joined: 11 Nov 2005
- Contact:
Try replacing the Condition line to something like:
If Condition1 = <something> then begin...
I noticed that PL doesn't always handles it correctly when you set a variable to TRUE/FALSE or 1/0 and you still have to refer to it as "If Condition1 = 1" and just using "if Condition1" doesn't always works.
- Fanus
If Condition1 = <something> then begin...
I noticed that PL doesn't always handles it correctly when you set a variable to TRUE/FALSE or 1/0 and you still have to refer to it as "If Condition1 = 1" and just using "if Condition1" doesn't always works.
- Fanus
- Marina Pashkova
- Posts: 2758
- Joined: 27 Jul 2007
Hi t123knight,Thanks so much for your help. Ok, this is what I have so far.
Array: SetT[8,3];
Var: _i(0);
Var: _j(0);
If condition1 then begin
For _i=0 to 8 begin
For _j=0 to 3 begin
SetT[_i, _j]=3;
end;
end;
end;
I'm getting an error that read "equal sign '=' expected" and the cursor stops right at the line "For _i=0 to 8 begin" on the underscore "_" Am I missing something? Also, what does the =3 designate?
Array: SetT[8,3](0);
Var: _i(0);
Var: _j(0);
If condition1 then begin
For _i=0 to 8 begin
For _j=0 to 3 begin
SetT[_i, _j]=3;
end;
end;
end;
- Marina Pashkova
- Posts: 2758
- Joined: 27 Jul 2007
Hi Fanus,Try replacing the Condition line to something like:
If Condition1 = <something> then begin...
I noticed that PL doesn't always handles it correctly when you set a variable to TRUE/FALSE or 1/0 and you still have to refer to it as "If Condition1 = 1" and just using "if Condition1" doesn't always works.
- Fanus
We haven't been able to reproduce the problem you're describing. Could you please contact our customer support representatives at http://messenger.providesupport.com/mes ... pport.html to show them the issue via the remote control connection.
Marina
The following code doesn't compile:
The following code doesn't compile:
The following does:var: Check(0);
If 1 = 1 then Check = 1 else Check = 0;
If Check then buy next bar at open else sell next bar at open;
and this compiles too..var: Check(0);
If 1 = 1 then Check = 1 else Check = 0;
If Check = 1 then buy next bar at open else sell next bar at open;
I am used to in other programming languages that 0/1 can be substituted for FALSE/TRUE.var: Check(FALSE);
If 1 = 1 then Check = TRUE else Check = FALSE;
If Check then buy next bar at open else sell next bar at open;
- Marina Pashkova
- Posts: 2758
- Joined: 27 Jul 2007