[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

EasyLang Function Execution



PureBytes Links

Trading Reference Links

One thing that has been confusing me for some time is the history of a
function and the function storage.  Something I saw on the list a while
back which gave me a hint, but I'm having trouble forming a question.


Let me start by example.  What exactly is happening in the following
function call?

	x = MyFunc(a, b, c)[5];

When I asked some questions to Omega a couple of months ago, I was led to
believe that x would be set to the value that MyFunc generated 5 bars ago -
and it was retrieved from storage (i.e. it wasn't re-executed).  I may have
worded my question poorly or may have misinterpretted their answer.

If that is the case (x is what MyFunc(a, b, c) generated 5 price bars ago),
are the values of a, b and c assumed then to have the values they had 5
price bars ago?

So what I am envisioning then, is TS executes all of the functions that are
referenced by a system or indicator when it moves to a new bar.  The inputs
to these functions are the current values of the variables for that price
bar.  The function results are stored.  Then the system/indicator code is
executed and any reference to a function simply does a lookup (the inputs
are disregarded in the case of a reference to a function N bars back).
Then TS moves to the next bar, updates the function values again and then
executes the code.

Is this correct or close?

If the function storage for MyFunc is set to simple instead of a series,
what happens then?

Any help in unravelling this mystery will be greatly appreciated!

Thanks,
Dave