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

Re: Multidimensional Arrays + Easylanguage Dates



PureBytes Links

Trading Reference Links


-----Message d'origine-----
De : Alan Mi <ami@xxxxxxxxx>
À : omegalist <omega-list@xxxxxxxxxx>
Date : dimanche 25 avril 1999 06:35
Objet : Re: Multidimensional Arrays + Easylanguage Dates


>Patrick and Jimmy,
>
>Create an indicator "test" by pasting the following code segment into it
>and applying it to your TS2000i chart. (TS4 users won't have the
>luxury.) Bring up a message log. I don't know of an simple way of
>sticking the 0 to make month / day strictly 2 digits. Some one know
>please respond. - Alan
>
>
>array: arr[2,3](0); {or arr[1,2](0, data1)}
>var: ii(0), jj(0);
>
>if LastBarOnChart then begin
>   Print(Month(D):2:0, "/", DayOfMonth(D):2:0, "/", Year(D):2:0);
>   for ii=0 to 1 begin
>      for jj=0 to 2 begin
>         arr[ii,jj] = ii*10 + jj;
>      end;
>   end;
>   for ii=0 to 1 begin
>      for jj=0 to 2 begin
>         Print(arr[ii,jj]);
>      end;
>   end;
>end;
>
>Plot1(0, "test");
>
>


FYI, 2 dimentional arrays WORK in TS4.
 up to n= 10 dimensions were allowed, unfortunately there was a bug for n>2
in TS4.

I wrote this test with three dimentional array.
You may verify that it works now in TS2000i.


{Test Program Illustrating the Error}

Array: Monica[8,8,8]("A bug in an undocumented function is not a true bug");
vars:j(0),k(0),m(0);

if barnumber=1 then

for j=1 to 6 begin
 for k=1 to 6 begin
  for m=1 to 6 begin
   {Monica[j,k,m]=StrToNum(NumToStr(j,0)+NumToStr(k,0)+NumToStr(m,0));}
   Monica[j,k,m]=NumToStr(j,0)+NumToStr(k,0)+NumToStr(m,0);
  end;
 end;
end;

if lastbaronchart then
for j=1 to 6 begin
 for k=1 to 6 begin
  for m=1 to 6 begin
   {print(Monica[j,k,m]:1:0,"
",StrToNum(NumToStr(j,0)+NumToStr(k,0)+NumToStr(m,0)):1:0);}
   print(Monica[j,k,m],"    ",NumToStr(j,0)+NumToStr(k,0)+NumToStr(m,0));
  end;
 end;
end;




if FALSE then Plot1(Value1, "");

{
--------------

Resulting printout:

   980806 1615 70 73 77  3  7

It should be:

   980806 1615  7 37 77  3  7

ConclusioMonica: Two dimeMonicaional arrays work but three dimeMonicaional
arrays do
not due to an error in calculating the indexing. (Obviously, it never could
have been tested.)
}