PureBytes Links
Trading Reference Links
|
> I plot an indicator that the input chooses which actual indicator to
> plot. My question is, with the code as below, are all these
> indicators being computed on each bar or just the one chosen. If
> they are all being computed is there another way so only the one
> chosen will compute? Those triple X Averages are mighty slow.
I can't figure out how to tell if a function is Series or Simple
in TS2k, but I'm certain they're both Series.
A Series function is called on every bar, regardless of whether
your code calls it or not. It's "pulled out" and called
separately, then the result is referenced in your code if
required.
That's necessary for a function that relies on previous values.
Average, for example, totally computes its value on every bar, so
it doesn't rely on previous results. Xaverage, though, uses the
previous value of Xaverage to compute the next value, so it MUST
be called on every bar to get the right answer.
In your case you would NEVER need to to call the triple xavg if
Choice = 1. But I can just about guarantee EL isn't smart enough
to figure that out, even though CHOICE is an input (and thus
can't change from bar to bar).
So if you really hate the delay of those triple xavgs when you're
not using them, then you're going to have to pull them out and
put them into a separate indicator.
Gary
|