Announcement

Collapse
No announcement yet.

getValue versus getValueAbsolute weirdness

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

  • getValue versus getValueAbsolute weirdness

    Hello,

    I'm having a problem understanding the results returned from getValue functions versus getValueAbolute.

    Here's my situation....I had a formula running today and it puts time into a 24hour format, eg:

    function tsTime() {
    var h = getHour(0);
    var m = getMinute(0);
    debugPrintln("h:"+h+" m:"+m);
    h *=100;
    h += m;
    debugPrintln("ret:"+h);
    return h;
    }

    I was running formulas that use this function on two symbols today, ZLC and EZ on 5 minute intervals. I noticed a weird time values at 1:05pm today EST, so I turned on debugging of minute and hour variables in my function, here is what I got with getHour and getMinute (as above):

    ret: 930
    h: 9 m: 30

    I can't figure out why this is happening, I also tried using getValue("hour",0) and got same result. I have "Auto" time template selected, time and time zone set properly on my machine, never had a problem with this function before.

    When I switched to use getValueAbsolute rather than getValue, everything worked properly and I got:

    re: 1305
    h: 13 m: 5

    Why does this happen? From the documentation I see that getValueAbsolute returns values at bar index relative to 0 regardless of bar currently being processed... but I don't understand why getValue(0) and getValueAbsolute(0) wouldn't return the same value... or where getValue("hour",0) was getting a 9 from???

    isn't the EFS formula always processing the current bar unless you're initially loading the formula, or if it's operating in tick playback mode? I'm really confused about this discrepency, documentation is a little sparse on these serious objects in the knoweldge base.

    Please help!

    thanks.

    -josh

  • #2
    Hello Josh,

    As far as I can tell your function is working properly. I'm not seeing any return values that aren't matching the time stamp of the corresponding bar. Try the code example below. It plots the return result as a histogram so that you can quickly compare the return result to the time stamp in the cursor window.

    PHP Code:
    function preMain() {
        
    setStudyTitle("Test");
        
    setCursorLabelName("Test1");
        
    setPlotType(PLOTTYPE_HISTOGRAM0);
    }


    function 
    main() {

        var 
    tsTime();
        
    //debugPrintln(getCurrentBarIndex() + "  " + s);
        
        
    return s;
    }

    function 
    tsTime() {
        var 
    getHour(0);
        var 
    getMinute(0);
        
    //debugPrintln("h:"+h+" m:"+m);
        
    *=100;
        
    += m;
        
    //debugPrintln("ret:"+h);
        
    return h;


    As far as the difference between getValue() and getValueAbsolute(), the bar index used with getValue() is relative to the bar that is being processed by the EFS, whereas with getValueAbsolute() it refers to the bar index of the chart. While an EFS is loading and processing historical bars, getValueAbsolute("hour", 0) will always refer to the right-most bar loaded in the chart. getValue("hour", 0) will refer to the current bar that is being processed. For example if the formula is processing bar -10 and it's hour is 9 and bar index of 0's hour is 10, getValue("hour", 0) will return 9 and getValueAbsolute("hour", 0) will return 10. When the EFS is processing in real time at bar 0, getValue() and getValueAbsolute() will both be referring to the same bar. Does that help?
    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

      Jason,

      thanks for getting back to me so quickly... your explanation of getValue and getValueAbsolute is consistent with the description in the EFS knowledgebase. I guess I have three questions, listed below:

      My understanding of getVal vs getValAb was that when you load an EFS script, getValueAbsolute would refer to the right most bar, and getValue would refer to the current bar being processed by EFS... _but_ this processing would be over quickly (few moments) and then getvalueAbsolute and getValue would return the same values for bar zero (when processing of old bars was complete)...

      1) To restate, am I correct in saying that getVA and getV should return same values for bar zero except right after a reload?

      I'm also confused about your term 'realtime mode'... what does realtime mean? realtime has nothing to do with whether I'm using tick replay or not, correct? Because I can run this script against live t&s data from esignal OR against a tick replay file and it works the same for me. I'm assuming you're using realtime mode to be a relative term that means processing of the most recent data available (whether from esignal or tick replay).

      2) to restate, getValue and getValueAbsolute should return the same value at bar zero in tick replay except right after a reload?


      This is good to clarify my understanding of chart vs EFS processing... although it doesn't explain why yesterday in ZLC tsTime was returning 930 over and over on a script that had been running for hours when it was actually 1305pm...

      3) is it possible a script or eSignal can get stuck in EFS processing on a bar without returning a formula error (or other error)?

      Otherwise the only explanation of yesterday is that I am completely insane. I hope not... thanks.

      Comment


      • #4
        Re: thanks

        Hello Josh,

        Originally posted by jfranta
        Jason,

        thanks for getting back to me so quickly... your explanation of getValue and getValueAbsolute is consistent with the description in the EFS knowledgebase. I guess I have three questions, listed below:

        My understanding of getVal vs getValAb was that when you load an EFS script, getValueAbsolute would refer to the right most bar, and getValue would refer to the current bar being processed by EFS... _but_ this processing would be over quickly (few moments) and then getvalueAbsolute and getValue would return the same values for bar zero (when processing of old bars was complete)...


        1) To restate, am I correct in saying that getVA and getV should return same values for bar zero except right after a reload?
        That is correct. When the EFS is processing in real time at bar 0, getValue() and getValueAbsolute() will both be referring to the same bar. They will not refer to the same bar during the processing of the historical bars (i.e. all bar indexes prior to bar 0).

        I'm also confused about your term 'realtime mode'... what does realtime mean? realtime has nothing to do with whether I'm using tick replay or not, correct? Because I can run this script against live t&s data from esignal OR against a tick replay file and it works the same for me. I'm assuming you're using realtime mode to be a relative term that means processing of the most recent data available (whether from esignal or tick replay).

        2) to restate, getValue and getValueAbsolute should return the same value at bar zero in tick replay except right after a reload?
        Correct. While processing the right-most bar they will refer to the same bar. They will not refer to the same bar during the processing of the historical bars (i.e. all bar indexes prior to bar 0).

        This is good to clarify my understanding of chart vs EFS processing... although it doesn't explain why yesterday in ZLC tsTime was returning 930 over and over on a script that had been running for hours when it was actually 1305pm...

        3) is it possible a script or eSignal can get stuck in EFS processing on a bar without returning a formula error (or other error)?

        Otherwise the only explanation of yesterday is that I am completely insane. I hope not... thanks.
        I have never seen this happen. Is the script exhibiting this behavior today? If so, please post a complete formula example that I can test on my end. Also please include your time template settings you are using and I'll look into further.
        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
          think the problem is the date is stuck

          Ok jason... this problem did not reoccur yesterday but it's happening again today... I rewrote a simpler test script and it was still doing the problem, then I added the current date to the output... and I see what's messed up... it's not getting the current day's worth of data in certain charts... some charts work fine, but others are lagged by a day even though they report being at bar zero:

          this was happening wednesday but didn't happen yesterday.

          attached is a screenshot of what's happening in GPS today... in #1 you can see datamanager symbol monitor, which has the correct values (as does the quote window). However, the script output in #2 don't match, even though the bar count is zero and the time is correct... the date and high/low/open data for gps is one day old. In #3 you can see my script which I also posted below, and in #4 you can see that the gps chart shows yesterday's data rather than today.

          I've tried opening a new chart, clicking ctrl+ok on the cursor window... doesn't fix it. What's weird is that it shows the correct information in data manager and quote window, but not in the formula... jason please help me whats going on? this is the third day this week I've noticed this problem, although first screenshot I have.



          Here is full code:

          Code:
          function preMain() {
             setStudyTitle("ohl-date");
             setCursorLabelName("ohl-date");
          }
          
          
          function main(){
             var xDate = day(0,sym("TGT=N,D"));
             debugPrintln(tsDate()+" t:"+tsTime()+" b:"+getCurrentBarIndex()+" l:"+lowD()+" o:"+openD()+" h:"+highD());
          }
          
          function tsDate() {
             var d = day(0,inv("D"));
             var yr = year(0,inv("D"));
             var mo = month(0,inv("D"));
             mo *= 100;
             yr *= 10000;
             yr += mo + d;
             return yr;
          }
          
          function openD() {
            return open(0,1,inv("D"));
          }
          
          function highD() {
            return high(0,1,inv("D"));
          }
          
          function lowD() {
            return low(0,1,inv("D"));
          }
          
          function closeD() {
            return close(0,1,inv("D"));
          }
            
            
          
          function tsTime() {
             var h = hour(0,inv(1));
             var m = minute(0,inv(1));
             h *=100;
             h += m;
             return h;
          }

          Comment


          • #6
            also fyi

            my time template is set to auto (default/auto/auto/auto).

            I also tried restarting data manager... the problem was still occuring.

            Finally I restarted all of esignal and this corrected the problem.

            Seems like some sort of data bug in esignal?

            Comment


            • #7
              Hello Josh,

              Good to hear this is now resolved for you. Your application was just having some connection problems with the data servers. This can happen once in a while. The solution is to force your application to reconnect to the server farm by shutting down the application and restarting as you did. You could also do a Ctrl+E in eSignal, which will shut down both eSignal and the data manager. If you continue to have connection problems like this, the best thing to do is call into tech support and have them check which servers you are connected to. This will help us identify which servers are having any problems.
              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