Announcement

Collapse
No announcement yet.

getXXX() time functions bug?

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

  • getXXX() time functions bug?

    I have an EFS that ran for months flawlessly under pre-7.8 releases. It also seemed to run for about 1 month after upgrading, but now errors.

    After some playing, I determined that execution hit a section of code that did a getYear(barno); and that execution for that bar/tick stopped at that point (even though it shouldn't) and then when the next tick came in I got an error because some variables had not been initialized.

    After reducing the code to a test case (see attached) I found that it happened even with a very simple segment of code. After looking at it, I saw why it didn't work and fixed the code (I was using an absolute bar index for a function that wants a relative bar index). I bring this up to:

    1) Point out that the results are inconsistent between releases
    2) Not correct for either result (it should throw and error and continue, not abort execution nor produce seemly valid results)
    3) Warn others that may run into the same problem.


    Thanks for letting me whine...

    Garth
    Attached Files
    Garth

  • #2
    Hi Garth,

    I've been looking into this and I agree. It seems as though something has changed. I'm reporting this to development. In the mean time your solution is to validate nOldest before passing it to the getYear() function etc. Also, instead of using BARSTATE_ALLBARS as the priming trigger, you should use a global boolean.
    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
      Hi Jason,

      Thanks for the reply. I agree checking for a valid return from a function call would be good programing practice, and I will add that, though in this case I know that isn't the problem as I have printed out nOldest and it is valid.

      I'm not sure why ALLBARS vs a priming trigger makes a difference...in fact it shouldn't in this case...unless you are telling me ALLBARS is unreliable (which I have never found to be the case).

      Thanks,

      Garth
      Garth

      Comment


      • #4
        Hi Garth,

        What I'm seeing is that getOldestBarIndex() is returning null, which in turn causes getYear() to fail. I'm testing this in 7.9 currently, so there could be something else going on. It's also possible that getYear() was handling this null exception properly before, which could be why this didn't fail on previous versions. Are you beta testing 7.9?

        I'm not saying that ALLBARS is unreliable. The problem with using ALLBARS for a priming routine is that ALLBARS will only occur once regardless. In the event that your variables aren't properly initialized in your priming routine you need to have that section of code execute again on the next bar. Once you know you've got proper values for your time variables then set the global boolean to true so that your priming routine won't execute on subsequent bars.
        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
          Hi Jason,

          Thanks for the reply. I'm running 7.8. I should load up 7.9 on one of my accounts to try it out...I may do that today.

          I never saw a null return, in the 5 or 6 times I ran it with a debug statement deplaying nOldest. So you might be onto yet another difference...not that 5 or 6 times is a big sample size.

          I understand your comment on ALLBARS, but in truth I only want this to run on ALLBARS...what I really need to do is bomb out in main() if my variables don't get initialized properly...and therefore the EFS will not display bad data.

          Thanks again for your help.

          Garth
          Garth

          Comment

          Working...
          X