Announcement

Collapse
No announcement yet.

erroneous values on multiple time frame in bar replay

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

  • erroneous values on multiple time frame in bar replay

    Im attempting to write a framework for multiple time frame studies. When i have the study running in real time it works properly (pulling moving average prices from multiple time frames)

    However,

    When i try to run the study in bar replay mode, if i attempt to pull anything other than the current charted time frame, it returns the most recent price for that study (instead of the one in reference to wherever i am in bar replay mode.

    Example:

    function main () {
    var cable5 = close(sym("GBP A0-FX,5")); // the symbol
    var cable30 = close(sym("GBP A0-FX,30")); // the symbol

    var len1 = 5; // length for the trigger ma
    var len2 = 50; // length for the long ma
    var len3 = 100; // length for the trend ma

    trig_study = sma(len1, cable5);
    long_study = sma(len2, cable5);
    trend_study = sma(len3, cable5);

    trig30_study = sma(len1, cable30);
    long30_study = sma(len2, cable30);
    trend30_study = sma(len3, cable30);



    // 5 min on cable
    trigma = trig_study.getValue(0);
    longma = long_study.getValue(0);
    trendma = trend_study.getValue(0);

    // 30 min on cable
    trig30 = trig30_study.getValue(0);
    long30 = long30_study.getValue(0);
    trend30 = trend30_study.getValue(0);

    return new Array(trigma, longma, trendma,trig30,long30,trend30);
    }



    My chart is set on the 5 minute period. In real time the code works fine. In bar replay mode, the trig30 studies being returned are from the current price rather than the price that would be from that period in bar replay.


    What should i be doing to retrieve bar replay based values?

    thanks in advance
    -=tam
    Last edited by techlord; 01-18-2006, 01:30 PM.

  • #2
    Hello techlord,

    Make sure your time template is not set to load a specific number of bars. This is an existing bug known as EDL #11169 in our system that is the likely cause of what you are seeing. Try changing your time template to a set number of days or dynamic and try it again. Please let me know if that corrects the replay.
    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
      I am alreading using a specific time template for 120 days. (the maximum number of back days i can go if im not mistaken).

      This is really weird because close() in bar replay mode always pulls from the current mode.. (as opposed to getMostRecentBid or getMostRecentAsk)

      This is kind of a huge thing as it means I cant do multi time frame backtesting at all unless im missing something. My only alternative is to write routines to generate moving average studies myself instead of using the efs2 sma object. A lot of extra work..

      Any other thoughts?


      thanks
      -tam

      Comment


      • #4
        Hello techlord,

        I tested your code yesterday and it worked fine. You may not have the time template setup correctly. Please post an image of your current settings and I'll test it again. Also, what is the version and build number you are currently using?

        The getMostRecent functions do not have access to historical data. They can only be used in real time.
        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


        • #5
          Jason,

          If it is working correctly for you, Can you please send me the script you are using as well as your time template (configuration). I will attempt to mimic what you are using.

          I am using esignal version 7.91 build 738 release 9/12/2005


          -tam

          Comment


          • #6
            Hello techlord,

            We're using the same version, good. The code I used was the code you posted at the beginning of this thread with the identifiers properly initialized.

            PHP Code:
            function preMain() {
                
            //setPriceStudy(true);
                
            setShowCursorLabel(false);
            }


            function 
            main () {
                var 
            cable5 close(sym("GBP A0-FX,5")); // the symbol
                
            var cable30 close(sym("GBP A0-FX,30")); // the symbol
                
                
            var len1 5// length for the trigger ma
                
            var len2 50// length for the long ma
                
            var len3 100// length for the trend ma
                
                
            var trig_study sma(len1cable5);
                var 
            long_study sma(len2cable5);
                var 
            trend_study sma(len3cable5);
                
                var 
            trig30_study sma(len1cable30);
                var 
            long30_study sma(len2cable30);
                var 
            trend30_study sma(len3cable30);
                
                
                
                
            // 5 min on cable
                
            var trigma trig_study.getValue(0);
                var 
            longma long_study.getValue(0);
                var 
            trendma trend_study.getValue(0);
                
                
            // 30 min on cable
                
            var trig30 trig30_study.getValue(0);
                var 
            long30 long30_study.getValue(0);
                var 
            trend30 trend30_study.getValue(0);
                
                return new Array(
            trigmalongmatrendma,trig30,long30,trend30);

            Here's the time template settings I used. I also tested 120 days and it worked properly as well.



            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


            • #7
              I think i know what is going on now. When i have a 5 min 120 template loaded, and when my efs is calling the sma object referencing a 30 min timeframe, since i am NOT using a 30 min 120 day template, it simply cannot do it and defaults to real time data.

              This might be less of a bug and more of a limitation by design. The only logical way around this (that i can see) is to design my own object that calculates higher time frames based on the current time frame (ie have a function that generates 30 min bar closes by multiplying 5 * 6. Maybe save every 6th bar into an array and process them).

              I dont suppose there is some way to have the sma/ema object force load a specified time template? or maybe have some kind of 120 day template that contains both 5 min and 30 min interval data?

              Im sure im not the first person to run into this. Does anyone else have a solution or workaround?

              BTW Jason, the couple times i thought i had this working were in error. I mistakenly had a chart setup for GBP A0-FX 30 min 120 day, then in the efs, am directly referencing 5 and 30 intervals in the sma calls. Obviously the smaller timeframe wont plot correctly when you are configured with a higher interval.

              In case this helps, I have included a screen shot of my setup.


              PS: I just saw the GIF you posted as i was posting this message and noticed you are NOT plotting as a price study. Do you think that could be a reason this is not working? (look at my screenshot, I am plotting on the price). Will try your way shortly.


              Thanks

              -=t
              Attached Files

              Comment


              • #8
                Hello techlord,

                Plotting as a price or non-price study would not make a difference.

                I dont suppose there is some way to have the sma/ema object force load a specified time template? or maybe have some kind of 120 day template that contains both 5 min and 30 min interval data?
                Yes there is. However, if the time template you are using on the 5-minute chart has an intraday default set to Dynamic it should work just like it does in the animation I previously posted. That is what I had in the time template used for that example. To force the 30-minute interval to load 120 days of data you simply specify those settings in the time template for that interval in the same time template that you are using on the 5-minute chart as follows.



                If this doesn't solve the problem, post an image of your time template that you are using on the 5-minute chart like the image above.
                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


                • #9
                  Jason!

                  That did the trick.. per your illustration, i simply added both the 5 min 120 day and the 30 min 120 day configuration to a SINGLE template (before I had 2 templates... one with the 5min /120 day, the other with 30min/120 day)..

                  The framework is working perfectly now. .. Take a look:


                  Also, I have attached a screen shot with my current time template settings. (maybe they will help someone else)..

                  Thanks again for your prompt assistance!

                  -=t
                  Attached Files

                  Comment


                  • #10
                    Hmm.. looks like i can only attach one image per post. Here is what my multi time frame study looks like now that it is working:



                    Thanks again for your help!
                    -=t
                    Attached Files

                    Comment

                    Working...
                    X