Yes, OK but that's the AB environment. So the code you added. If I should use 
MyArray in whatever procedure that's not writing to the AB screen then I will 
have an array with 11 elements. Try to access element number 200 or something 
like LastNum = MyArray[200] and what you will get is an error message. This 
element does not exist and so I am getting 'Subscript out of range'. Therefore 
I just do not understand why I should have created an array with the size of 
BarCount. Or better, I have created an array with BarCount 11. Also see error 
message ...



Regards, Ton.

  ----- Original Message ----- 
  From: Edward Pottasch 
  To: [email protected] 
  Sent: Friday, June 15, 2007 12:44 PM
  Subject: Re: [amibroker] New file uploaded to amibroker



  Ton,

  what I meant is that when you execute the code:
  for (i = 0 ; i < 11; i++) MyArray[i] = 0;

  you do not creat an array with the length 11 filled with zeros. Rather you 
have created an array MyArray with the length BarCount which is filled with 
zeros.

  You can easily check this when you add the following code to any chart:

  for (i = 0 ; i < 11; i++) MyArray[i] = 1; 

  "myarray" + WriteVal(MyArray); 

  you will find that the first 11 elements of the array MyArray are filled with 
"1" and the rest (up until Barcount) are filled with zeros,

  rgds, Ed 




    ----- Original Message ----- 
    From: Ton Sieverding 
    To: [email protected] 
    Sent: Friday, June 15, 2007 12:34 PM
    Subject: Re: [amibroker] New file uploaded to amibroker



    But Ed, please explain me the difference. Look to the AFL formula I posted 
and check what you get in DbgView. That's an array with 10 elements. How do you 
call the creation of an array with 10 elements ? Isn't that setting the 
dimension of an array ? Of course not in the way we are familiar with in other 
programming languages. But the final result is the same. Or ?

    Ton.

      ----- Original Message ----- 
      From: Edward Pottasch 
      To: [email protected] 
      Sent: Friday, June 15, 2007 11:23 AM
      Subject: Re: [amibroker] New file uploaded to amibroker



      setting a dimension of an array is not possible in Amibroker. Also multi 
dimensional arrays are not yet possible but I believe this is planned for.

      In my opinion datastructures would be handy as well, as ofcourse the 
possibility to create objects, not sure if these are planned for.

      For multidimensional arrays in Amibroker one could use Osaka plugin I 
believe but as far as I know it is not really easy in use,

      Ed




        ----- Original Message ----- 
        From: Ton Sieverding 
        To: [email protected] 
        Sent: Friday, June 15, 2007 11:04 AM
        Subject: Re: [amibroker] New file uploaded to amibroker



        Hi, good and very practical AFL article. Would be a good text as 
introduction for the AFL manual. I have a question. Somewhere in this article 
it says :
        Where AFL arrays differ from generic arrays in other programming 
languages is that AFL arrays always match the bars on the current chart, so the 
size of the array (ie. the number of values in the array) is the same as the 
number of bars on the chart. In other programming languages it's usually 
possible to specify the array size yourself, and store anything you like in the 
array.

        In other words where I can DIMENSION an array and specify its size in 
other programming languages, according to the above this should be impossible 
in AFL. But what am I getting with the following AFL instruction ? Isn't this 
the same as creating an array with 10 elements ?
        for (i = 0 ; i < 11; i++) MyArray[i] = 0;

        So in my opinion it should be possible to create one dimensional arrays 
in AFL. And this brings me to the next question. How about two dimensional 
arrays ? Does AFL support two dimensions in an array ? What happens when I 
create a two dimensional array in say Basic and pass this array to AFL ?

        Regards, Ton.

        --- Original Message ----- 

          From: [email protected] 
          To: [email protected] 
          Sent: Friday, June 15, 2007 7:01 AM
          Subject: [amibroker] New file uploaded to amibroker



          Hello,

          This email message is a notification to let you know that
          a file has been uploaded to the Files area of the amibroker 
          group.

          File : /Looping in AmiBroker AFL.pdf 
          Uploaded by : gp_sydney <[EMAIL PROTECTED]> 
          Description : An overview of using loops in AFL, covering arrays & 
indexing, loop constructs, the switch/case statement, and some examples. 

          You can access this file at the URL:
          
http://groups.yahoo.com/group/amibroker/files/Looping%20in%20AmiBroker%20AFL.pdf
 

          To learn more about file sharing for your group, please visit:
          http://help.yahoo.com/help/us/groups/files

          Regards,

          gp_sydney <[EMAIL PROTECTED]>








   

<<LAST.JPG>>

Reply via email to