[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

coding question



PureBytes Links

Trading Reference Links

ok,

let's say that I have an array and at the beginning of every day I want to
erase all the values but the last 2. how do you do this in Easy Language.
this is how it looks like at the beginning of the next day............


MyArray: [10](0);

[0]  [1]  [2]  [3]  [4]  [5]  [6]  .......

11  22  33   44  55

and this is how I would like it to be:

[0]  [1]  [2]  [3]  [4]  [5]  [6]  .........

44  55

this is the code I am using but I keep getting the run time error.

vars: Newday(false),Newdaycounter(0),ok(false),counter(0);

newday=date<>date[1];


if newday then
    newdaycounter = newdaycounter + 1;
    ok = false;

if newdaycounter >=2 and ok = false then begin
myarray[0] = myarray[counter - 2];
myarray[1] = myarray[counter - 1];
counter = 2;
ok=true;
end;

everytime the loop or the if...then statement populate myarray I use counter
= counter + 1 to prepare it for the next value.

can some one tell me what's wrong with this code?

thanks in advance

FR