PureBytes Links
Trading Reference Links
|
I believe that varSet is a fairly flexible way to achieve this. Look
at TJ's example functions below. Before you do, one more point: I
have requested in FB-centre for native matrix-functions to be made
available (i.e. M-create, M-transpose, M-inverse), which would truly
allow multi-dimenional array calc, i.e. beyond 2-dimensions. In my
view crucial when making calculations for portfolios/holdings, either
current or via (CBT) backtests. The more votes the more chance of TJ
implementing it.
Now to TJ's functions:
function Set2DimTable( tablename, x, y, value )
{
VarSet( tablename + StrFormat("%05.0f%05.0f", x, y ), value );
}
function Get2DimTable( tablename, x, y )
{
return VarGet( tablename + StrFormat("%05.0f%05.0f", x, y ) );
}
Example use:
Set2DimTable( "blabla", 2, 3, High[ 0 ] );
This actually shows how VarSet/VarGet can be used to implement
"equivalent of doubly dimensioned arrays i.e. tables in pure AFL".
PS
--- In amibroker@xxxxxxxxxxxxxxx, "Ton Sieverding"
<ton.sieverding@xxx> wrote:
>
> 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: amibroker@xxxxxxxxxxxxxxx
> To: amibroker@xxxxxxxxxxxxxxx
> 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 <gp.investment@xxx>
> 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 <gp.investment@xxx>
>
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|