Using eSignal example for efsInternal
var xStudy = null;
function main() {
debugPrintln("1")
if (xStudy == null) xStudy = ema( 20, efsInternal( "myCustomFunction", 5, close() ) );
debugPrintln("2")
return xStudy.getValue(0);
}
function myCustomFunction( length, source ) {
debugPrintln("3")
return( source.getValue(0) - source.getValue(-length) );
}
This is the output for 5 bars:
2
1
2
1
2
1
2
1
2
1
3
3
3
3
3
1
It appears the myCustomFunction function is called 5 times in a rows and then main() executes which doesn't make sense.
var xStudy = null;
function main() {
debugPrintln("1")
if (xStudy == null) xStudy = ema( 20, efsInternal( "myCustomFunction", 5, close() ) );
debugPrintln("2")
return xStudy.getValue(0);
}
function myCustomFunction( length, source ) {
debugPrintln("3")
return( source.getValue(0) - source.getValue(-length) );
}
This is the output for 5 bars:
2
1
2
1
2
1
2
1
2
1
3
3
3
3
3
1
It appears the myCustomFunction function is called 5 times in a rows and then main() executes which doesn't make sense.