I kindly ask Alex Montenegro to answer this, or someone at eSignal with similar knowledge of EFS internals.
I have a script that has no knowledge of what interval and symbol it is running with. And I would like to keep it that way. For example:
file coolIndicator.efs:
(the actual indicator is more complex, but I wanted to convey that:
a) it does not use any sym() or inv()
b) it does use getCurrentBarIndex() to track how many bars ago certain events have occurred.
The EFS Help page for efsExternal() says the following (only):
efsExternal( pathToEFS [, sym/inv] [, parameters] )
New in EFS2. Returns a series object representing the values as calculated from the given external EFS script. You would then use the getSeries() function to extract a specific series value if multiple series are returned.
The help page further gives an example:
Note that nothing is said regarding the support that myCustomEFS.efs must have for the external interval. It makes an impression that any simple script alike coolIndicator.efs, as mentioned above, would just be executed on IBM 15 min bars, without having to modify the called script to support multiple intervals/symbols.
I think I am finding out that it is not really true. The truth is, as Alex described
here and here that every EFS has to be retrofitted to work with multiple intervals.
In other words,
will only work when the main() function of blah.efs accepts Symbol and Interval parameters and uses it to call sym().
However, if EFS is modified in that way, it can no longer rely on getCurrentBarIndex() because this function always returns the index of the bar on the current chart and not that of the external timeframe.
Now, the BIG QUESTION:
Alex - or somebody who can answer this - would you be so kind to tell me whether my understanding of the situation is right or wrong?
If it is right - why would you not consider updating the EFS Help page for efsExternal() to avoid confusion. If wrong - can you give me an example of calling my script coolIndicator.efs (above) from another timeframe, without having to modify the code of the indicator (and so that getCurrentIndex() would work as it would natively).
I hope my question is not too convoluted.
Many thanks
pupkin2
I have a script that has no knowledge of what interval and symbol it is running with. And I would like to keep it that way. For example:
file coolIndicator.efs:
PHP Code:
function main()
{
if (getCurrentBarIndex() % 3 == 0)
return open(0);
else
return close(0);
}
a) it does not use any sym() or inv()
b) it does use getCurrentBarIndex() to track how many bars ago certain events have occurred.
The EFS Help page for efsExternal() says the following (only):
efsExternal( pathToEFS [, sym/inv] [, parameters] )
New in EFS2. Returns a series object representing the values as calculated from the given external EFS script. You would then use the getSeries() function to extract a specific series value if multiple series are returned.
The help page further gives an example:
PHP Code:
//call an external EFS called "myCustomEFS.efs" and load it into
//the context of IBM 15-min bars. we also pass two parameters
//to the script.
myVar = efsExternal( "myCustomEFS.efs", sym( "IBM,15" ), 20, 5 );
I think I am finding out that it is not really true. The truth is, as Alex described
here and here that every EFS has to be retrofitted to work with multiple intervals.
In other words,
PHP Code:
efsExternal("blah.efs", inv(10))
However, if EFS is modified in that way, it can no longer rely on getCurrentBarIndex() because this function always returns the index of the bar on the current chart and not that of the external timeframe.
Now, the BIG QUESTION:
Alex - or somebody who can answer this - would you be so kind to tell me whether my understanding of the situation is right or wrong?
If it is right - why would you not consider updating the EFS Help page for efsExternal() to avoid confusion. If wrong - can you give me an example of calling my script coolIndicator.efs (above) from another timeframe, without having to modify the code of the indicator (and so that getCurrentIndex() would work as it would natively).
I hope my question is not too convoluted.
Many thanks
pupkin2
Comment