I've a few indicators that use other functions (or indicators), in the following manner
for example
temp = SMA(Volumes[0], 50)[0];
This might be called quite often (on price change for example).
I also have coded in some of the indicators, in a different way
for example, in declarations
private SMA SMA1;
SMA1 = SMA(Volumes[0], 50);
The access is via
SMA1[0];
So, my general query is, and basically just looking for your opinion, which is the most efficient to use, if being called regularly?
My thoughts were that the first results in the whole SMA calculation and series being evaluated each time. The second keeps it up to date on the fly, but at the cost of keeping the series in memory?
Is there a difference?
Which method would you recommend?
Thanks!
Comment