efsInternal()

eSignal EFS 2

efsInternal()

Top  Previous  Next

 

efsInternal( functionName [, parameters... ] )

 

New in EFS2. Returns a series object representing the values calculated from a given function name. The function specified will be executed as if it were a main() function being called in an external EFS. This is conceptually the same as the efs() function, the difference being that instead of calling an external file's main() function, the engine will call the user-defined function instead.

 

Note: If you pass a series object to the efsInternal() function, be sure to pass the series as the last parameter. This will force efsInternal() to execute in the series' sym/inv context.

 

Parameters

 

functionName

name of user-defined function to call

parameters

optional. parameters, if any, required by the user-defined function you are calling

 

Usage

 

function main() {

var myVar;

 

       ...

       ...

 

       //call a user-defined function as an input source to an ema

       myVar = ema( 20, efsInternal( "myCustomFunction", 5, close() ) );

 

 

}

 

//user-defined function. our function accepts two parameters and

//note that the series is passed as the last parameter.

function myCustomFunction( length, source ) {

       return( source.getValue(0) - source.getValue(-length) );

}