Hi. I'm not sure if what I'm about to describe is due to my many programming inadequacies or an eSignal functional limitation. If it's the former I apologize, if it's the latter - below is a functional but less than satisfying workaround.
I mentioned in an exchange with Alex a few years ago Link that calls from a chart of interval x to charts based on an interval less than x did not seem to be updating on every tick. He correctly pointed out that "... you need to consider that the efs will execute on each tick of the external symbol only if the time stamps of the external symbol are comparable (ie contained within) the interval of the main symbol." He then gave an illustrated example of calling the close() of EPREM AO based on a sixty second chart from a $SPX 15 minute chart. He also pointed out a syntax problem I had with my coding which when corrected solved the problem. But I've run into the problem again and I don't think it is being caused by a syntax error or a lack of time stamp synchronization since the calling and called studies are both based on the same symbol. Here's the problem:
Consider the following program:
var bInit = false;
var TestStudy = null;
function preMain(){}
function main(){
if(bInit == false){
TestStudy = efsExternal("MikesStudy.efs", inv("250V"));
}
var TestVar = getSeries(TestStudy):
or
var TestVar = TestStudy.getValue(0);
return TestVar;
}
If I run this study on a 4000V chart and also put up a 250V chart of the same symbol with MikesStudy.efs on it, I can see that the indicator MikesStudy updates more frequently on the 250V chart than on the 4000V chart. I understand how a synchronization problem can occur when, as Alex pointed out, there is "no comparable time stamps to reference" but since in my case both charts contain the same symbol a tick on one chart is a simultaneous tick on the other. So if a tick on the 250V chart changes the value of the indicator generated on that chart, then indicator on the 4000V chart which is simply calling the results of the same study based on inv("250V") should change simultaneously. But it does not. My question is why doesn't it?
Possibly the problem is somehow associated with the fact that I am now using efsExternal() to call the results of a study rather than simply calling the close of another symbol as I was doing when I previously discussed this with Alex. I've also considered the possibility that if the called study contains the statement: if (getBarState()==BARSTATE_NEWBAR){} and this statement is executing based on the interval of the calling chart , 4000V, rather than the interval specified in the calling statement, 250V, and that this might be delaying the 4000V chart indicator updates. But I've run some tests compensating for this by using the more specific getBarStateInterval("250V") in the called study and this doesn't seem to be the problem. Any ideas what may be going on?
The workaround I mentioned above is simply to globalize the returned value of the called study and then pick up this global value in the calling study. If this is done both studies update simultaneously, but of course there's no chart backfill when dealing with a global value. So it's a workable but less satisfying solution. Thanks for any help.
Mike
I mentioned in an exchange with Alex a few years ago Link that calls from a chart of interval x to charts based on an interval less than x did not seem to be updating on every tick. He correctly pointed out that "... you need to consider that the efs will execute on each tick of the external symbol only if the time stamps of the external symbol are comparable (ie contained within) the interval of the main symbol." He then gave an illustrated example of calling the close() of EPREM AO based on a sixty second chart from a $SPX 15 minute chart. He also pointed out a syntax problem I had with my coding which when corrected solved the problem. But I've run into the problem again and I don't think it is being caused by a syntax error or a lack of time stamp synchronization since the calling and called studies are both based on the same symbol. Here's the problem:
Consider the following program:
var bInit = false;
var TestStudy = null;
function preMain(){}
function main(){
if(bInit == false){
TestStudy = efsExternal("MikesStudy.efs", inv("250V"));
}
var TestVar = getSeries(TestStudy):
or
var TestVar = TestStudy.getValue(0);
return TestVar;
}
If I run this study on a 4000V chart and also put up a 250V chart of the same symbol with MikesStudy.efs on it, I can see that the indicator MikesStudy updates more frequently on the 250V chart than on the 4000V chart. I understand how a synchronization problem can occur when, as Alex pointed out, there is "no comparable time stamps to reference" but since in my case both charts contain the same symbol a tick on one chart is a simultaneous tick on the other. So if a tick on the 250V chart changes the value of the indicator generated on that chart, then indicator on the 4000V chart which is simply calling the results of the same study based on inv("250V") should change simultaneously. But it does not. My question is why doesn't it?
Possibly the problem is somehow associated with the fact that I am now using efsExternal() to call the results of a study rather than simply calling the close of another symbol as I was doing when I previously discussed this with Alex. I've also considered the possibility that if the called study contains the statement: if (getBarState()==BARSTATE_NEWBAR){} and this statement is executing based on the interval of the calling chart , 4000V, rather than the interval specified in the calling statement, 250V, and that this might be delaying the 4000V chart indicator updates. But I've run some tests compensating for this by using the more specific getBarStateInterval("250V") in the called study and this doesn't seem to be the problem. Any ideas what may be going on?
The workaround I mentioned above is simply to globalize the returned value of the called study and then pick up this global value in the calling study. If this is done both studies update simultaneously, but of course there's no chart backfill when dealing with a global value. So it's a workable but less satisfying solution. Thanks for any help.
Mike
Comment