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

Re: [amibroker] Multi dimensional arrays



PureBytes Links

Trading Reference Links

Dynamic variables "VarSet()", are not arrays. They are individual elements that can be addressed because the variable name can be created in such a  manner.

Example:
//Create variable names for 10 elements
for (i=1; i<=10; i++)
{
VarName = "SGCoeff_" + i;
}

You can of course create any dimension "array" you want by using this scheme.

Caution though, these operations are not very fast, so for limited size "arrays" they aer ok, but for computation heavy operations they are not well suited.

Ara

  ----- Original Message ----- 
  From: David Jennings 
  To: amibroker@xxxxxxxxxxxxxxx 
  Sent: Saturday, December 30, 2006 12:47 PM
  Subject: [amibroker] Multi dimensional arrays


  I want to set up a two dimensional array 12 by 14 and populate it with data e.g.;

  SGCoef(1, 1) = 17;

  SGCoef(1, 2) = 12;

  SGCoef(1, 3) = -3;

  SGCoef(1, 0) = 35;

   

  SGCoef(2, 1) = 7;

  SGCoef(2, 2) = 6;

  SGCoef(2, 3) = 3;

  SGCoef(2, 4) = -2;

  SGCoef(2, 0) = 21;

   

  SGCoef(3, 1) = 59;

  SGCoef(3, 2) = 54;

  SGCoef(3, 3) = 39;

  SGCoef(3, 4) = 14;

  SGCoef(3, 5) = -21;

  SGCoef(3, 0) = 231;

   

  SGCoef(4, 1) = 89;

  SGCoef(4, 2) = 84;

  SGCoef(4, 3) = 69;

  SGCoef(4, 4) = 44;

  SGCoef(4, 5) = 9;

  SGCoef(4, 6) = -36;

  SGCoef(4, 0) = 429; etc. etc.



  I've read thru VarSet and VarGet and feel that I must be missing the point viz: if I keep referencing array locations with varset - will I not be recreating the array with a different dimensions and  the same value in each cell?





  Grateful for any help you can give.



  DJ


  __,_.
   
Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.16.0/610 - Release Date: 12/30/2006 2:59 PM