Processing time and memory allocation
Author: mikael
Creation Date: 10/8/2008 5:08 PM
profile picture

mikael

#1
Hi there

I've been very merrily building my own indicators. They're not of Ehler's sophistication, but well.

In Wealth-Lab 4 the way you built a series meant that the indicator name space was searched before running the code to build the indicat, which that meant that you could just call the series directly. In Wealth-Lab 5 it is unclear to me whether this is still the case. If I define a piece of code like (,which I made up for fun just now):
CODE:
Please log in to see this code.

and then make a call like
CODE:
Please log in to see this code.

what actually happens? Is the Log series built Count * 2 times, where processing time and memory would be gobbled up, or is it handled analogously to Wealth-Lab 4 through the base class DataSeries, where the only processing time is the searching of a name space. Naturally, this will have an input on code design.

Cheers
M
profile picture

Cone

#2
That's what happens in your example, yes, so you better not do it that way! Formal indicators have a caching mechanism to avoid that. To use any informal indicator like yours, assign it to a DataSeries variable and then use the index method.

CODE:
Please log in to see this code.
Although the API documentation is being reviewed (like how to create a formal indicator), you can refer to the WealthScript Programming Guide for more information about indicators.
profile picture

mikael

#3
OK, but I assume this DataSeries will get cached and thus enable me to continue in the Wealth-Lab 4.x way of doing things.

CODE:
Please log in to see this code.
profile picture

Cone

#4
Either method is the 4x way of doing things. But sure, if you want to going through the trouble of adding a caching mechanism, then it will work. The point is that it's not necessary to cache "informal" indicators when you know to write code that creates the series only once.
profile picture

mikael

#5
Unless of course the indicators are used with abandon inside other indicators then the code gets downright ugly.