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

RE: Inputs to systems with series functions



PureBytes Links

Trading Reference Links

From: "Earl Adamy" <eadamy@xxxxxxxxxx>

>>3) not allowed to declare variables in a system and set them equal to a data
series (e.g. NyClose = Close of Data3) when the data series is being passed to 
a series function e.g. f_one(NyClose).<<

I posted a message to a similar comment a while back, but it's worth posting 
again.

--------------------------------------------------------------------
Yuor finding touches a very important distinction between series and simple 
user functions.

All series user functions get "pulled out" of their calling program and are run 
BEFORE the calling program is entered.  This is required as a way to guarantee 
that the series user function will be called on EVERY bar, regardless on the 
logic contained within the calling environment.  The only way this can be 
accomplished is to require all inputs to the series user function be known a 
priori.  Therefore, series user functions cannot allow as inputs any variables 
defined and evaluated within the immediate calling environment, because these 
variables would be evaluated AFTER the series function would have already been 
called.

The reason why method #3 works is because both user functions are "pulled out" 
from the calling environment and evaluated together, prior to executing the 
rest of the code in the calling environment.

On the other hand, a type-SIMPLE user function will allow input variables to be 
defined within the immediate calling environment because type simple functions 
are not "pulled out" of the calling module.  The reason is because type simple 
functions are not expected to run on every bar, because they generally process 
non-time series data.  An example of a type simple function would be 
SQUAREROOT.

The great aspect to simple functions is that they can also process time series 
data, permitting the developer to "work around" the limitations of type series 
user functions.  This is how I was able to create a type simple RSI user 
function.  It can have its "length" parameter change on every bar.  Works 
great.

- Mark Jurik
********************************************
Tools for financial data preprocessing
Jurik Research     http://www.jurikres.com/ 
********************************************