Announcement

Collapse
No announcement yet.

Calling on an interval less than the interval on which the calling chart is based

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Calling on an interval less than the interval on which the calling chart is based

    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

  • #2
    Mike,

    You are correct in your assumptions as I would agree with your outcomes.

    As I understand it, when you load a chart that calls multiple intervals of data or datasets, then when you load/reload, it syncs based on the intervals you include. Thus, if you load one chart and have it call other interval data, it is synced to the servers at the time you load it.

    So, if you load up something that calls a 50t or 50v interval, that unique instance will be instantiated in the chart. Then, if you open up another chart and load another efs that calls 50t or 50v data, it won't sync to the other chart. It will sync on it's own to the servers.

    Given this differences in "instantiation starts", the data could be different.

    So, the solution is to either run it with globals or leave it alone and deal with the fact that you could have slightly different results on the different charts you open/use.

    I'm dealing with the same problem over here - so I know your troubles.
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      Hi Brad. Your explanation of why the problem occurs sounds plausible. I’ve decided from now on I'll put any multi-time frame studies on a chart based on the shortest interval the study calls thus skirting the issue altogether. Thanks for the feedback.

      Mike

      Comment

      Working...
      X