PureBytes Links
Trading Reference Links
|
> I didn't know that. You mean, if I make a function a series
> function, and I don't call it on every bar, it will get called
> anyway?
Exactamundo. Intuitive, wouldn't you say?
> How can this be possible?
EL hocus-pocus. The function call is "pulled out" of your code,
and executed on each bar regardless of what your code does. They
save the function return and use that in the point in your code
where you think you called the function. At least that's the way
it worked in TS4.
> How would TS know what parameters to pass to the function inputs, if
> they change every time the function is called?
Um. You *would* ask the hard question. :-)
I understood this in TS4, but that was a simpler world. TS4 DID
NOT allow you to pass variables to series functions. It would
only allow series variables (like price series) so it knew ahead
of time what you were passing to the function.
That changed somewhat in TS2k and later, though I've never seen
any written description of it. It appears that TS2k DOES allow
you to pass variables to series functions. It's a very good
question how they could "pull out" the function call, when you
may be computing the parameter values and they aren't known until
the point where you call the function -- and in fact may not be
computed at all unless your code calls the function.
> I think the old TS4 way of doing it had the potential to break less
> things. At least then the behavior was predictable. From what you
> say above, I can no longer predict what values my series functions
> should return if I don't call them on every bar.
See http://www.jurikres.com/down/simpser.pdf for some examples of
how Simple and Series functions can behave differently. Mark
wrote that for TS4, and he says TS2k has changed it -- but he
doesn't say how it changed. Maybe he's sat down and figured out
what's different, but I haven't.
Gary
|