I want a function to return an array with an initially unknown size. As far as I understood, the only way to pass an array, by reference, to a function, is using the following syntax:
inputs: arrName[MAXSIZE](NumericArrayRef);
variables: MAXSIZE(100);
Does it mean that array_setmaxindex can't be used inside the function, and that only static arrays can be passed by reference? This seems like a big waste of memory to create large arrays that are required only in some cases and not in others plus it complicates the code.
I also considered using Lists. I downloaded the ELCollections DLL to the correct folder but statements such "ListID = ListN.New; " indicate it isn't recognized. Another question - what is the scope of those lists? can a function access a list? I don't see how can a list be passed to a function..
Dynamic Arrays, Functions, Lists
-
- Posts: 63
- Joined: 13 Sep 2016
- Has thanked: 30 times
- Been thanked: 8 times
- ABC
- Posts: 722
- Joined: 16 Dec 2006
- Location: www.abctradinggroup.com
- Has thanked: 125 times
- Been thanked: 410 times
- Contact:
Re: Dynamic Arrays, Functions, Lists
TraderWalrus,I also considered using Lists. I downloaded the ELCollections DLL to the correct folder but statements such "ListID = ListN.New; " indicate it isn't recognized. Another question - what is the scope of those lists? can a function access a list? I don't see how can a list be passed to a function..
this sounds like you didn't import the corresponding ELD file with the required functions. You should be able to find it here on the forum. The original ELC disctribution also contains a manual which explains everything you need to know to get you going. In your case you'd pass the list ID to the function in case you want to use it there.
Regards,
ABC
-
- Posts: 63
- Joined: 13 Sep 2016
- Has thanked: 30 times
- Been thanked: 8 times
Re: Dynamic Arrays, Functions, Lists
I went through the detailed .doc manual, it doesn't mention what needs to be imported. Or perhaps you refer to another guide - specific information with links will be greatly appreciated.
- ABC
- Posts: 722
- Joined: 16 Dec 2006
- Location: www.abctradinggroup.com
- Has thanked: 125 times
- Been thanked: 410 times
- Contact:
Re: Dynamic Arrays, Functions, Lists
If you got the doc from the original zip file, it also contains the functions ELD that you'll have to import before you can use the DLL. You can probably find them here, although I didn't check it: viewtopic.php?=&p=8189
Regards,
ABC
Regards,
ABC
-
- Posts: 63
- Joined: 13 Sep 2016
- Has thanked: 30 times
- Been thanked: 8 times
Re: Dynamic Arrays, Functions, Lists
Ok, ELD file imported and it's being recognized and compiled. Any insights about the other points? I find myself spending hours on things that need to be trivial, managing simple data structures. Is life better with MC.NET?
- ABC
- Posts: 722
- Joined: 16 Dec 2006
- Location: www.abctradinggroup.com
- Has thanked: 125 times
- Been thanked: 410 times
- Contact:
Re: Dynamic Arrays, Functions, Lists
You can pass dynamic arrays to functions. Check out page 109 of the EL Essentials PDF and the examples there.
You'll have to check out what happens when you change the array size within the function.
Regards,
ABC
You'll have to check out what happens when you change the array size within the function.
Regards,
ABC