Announcement

Collapse
No announcement yet.

shot time frame series in long time frame chart problem

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

  • shot time frame series in long time frame chart problem

    I've run into this issue a few times before and ignored it but now I have to solve it. Due to recent volatility, I've had to add a short section of 1 minute bar trade stop code onto a 3000+ line efs running on a 5 minute chart and ended up withe quite a bit of null data on both dynamic and static time templates. Here is some proof of concept code:

    function preMain() {
    setPriceStudy(true)
    }

    //Globals
    xStudy1min=null;
    xStudy5min=null;

    // Run this on a 5 minute chart (I'm using dynamic chart)
    function main() {

    if(xStudy1min==null) xStudy1min=close(inv(1));
    if(xStudy5min==null) xStudy5min=close();

    for (var i=0;i<5;i++){
    debugPrintln(xStudy5min.getValue(0) +" "+xStudy1min.getValue(-i));
    }
    debugPrintln("********************");

    }

    On historic bars I am assuming that "main" only runs once per 5 minute bar so I try to specifically query the 5 individual minutes of the 1 minute series. The print-out consists of several hundred null values for the 1 minute series before I get a couple dozen prints at the end that are OK. Looks like:

    A lot of this
    ********************
    1254.5 null
    1254.5 null
    1254.5 null
    1254.5 null
    1254.5 null
    ********************
    1198.75 null
    1198.75 null
    1198.75 null
    1198.75 null
    1198.75 null
    ********************

    And then some of this at the very end (top):
    ********************
    1160 1160
    1160 1159.75
    1160 1159.25
    1160 1158.25
    1160 1160
    ********************



    I am assuming that what happens is that historical bars are only fetching the 5 minute series and the 1 minute series only exists for bars that were drawn when real - time data was being plotted (that's why a longer time series in a shorter time chart always works ok)???

    I must be missing something. (Being lazy I'd rather not recode/debug a few thousand lines to make them 5 minute dependant so I can plot them on a 1 minute chart; I also thought of passing globals between charts but that would prevent back-test)

  • #2
    Hello GP,

    You're mostly correct. There isn't the same number of days of data loaded for the lower time frame. Try adding setIntervalsBackfill(true) to preMain.
    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation

    Comment


    • #3
      Thanks for your rapid response. Tried the setIntervalsBackfill(true) but didn't seem to make any difference.

      The only other reference I could find in the form was your response in:

      that suggested to me that the shorter intervals somehow get loaded in.

      I guess I've got to to bite the bullet and redo the 5 min chart code (that I should have added a lot of inv(n) to in the first place.)

      I'd love to learn a little of the details on how/when various series get loaded when in historical mode.

      Comment


      • #4
        Wow. When I closed e-signal restarted and redid the chart the backfill worked!!!! Thanks, you saved me days of work.

        GP

        Comment


        • #5
          You're most welcome. For future reference, instead of restarting the application you could also just remove and then reapply the formula to the chart.
          Jason K.
          Project Manager
          eSignal - an Interactive Data company

          EFS KnowledgeBase
          JavaScript for EFS Video Series
          EFS Beginner Tutorial Series
          EFS Glossary
          Custom EFS Development Policy

          New User Orientation

          Comment

          Working...
          X