Announcement

Collapse
No announcement yet.

Problem with getNextTradingDay

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

  • Problem with getNextTradingDay

    The getNextTradingDay function looks like it could be fun to use but when I use the code below I get an error "Invalid Date Arguent in getNextTradingDay" message. Thank you for taking a look at the problem.


    function main()

    {
    var ttime = getValue("time");

    if (ttime == null)
    {
    return;
    }

    var next_trade_day = getNextTradingDay(ttime);

    if (next_trade_day == null)
    {
    debugPrint(next_trade_day+"\n");
    }
    }

  • #2
    just a guess but try

    var vTime = getValue("Time");


    with a capital T in Time

    Comment


    • #3
      Cape t is not the answer.

      I have used a capital t in time but it does not make a differance.

      Comment


      • #4
        You are correct, capital or small T time shouldn't make a difference. I have never used this specific fundtion before, not does a search through any of the sample/example efs files show its use anywhere.

        Your syntax looks correct...maybe you have discovered a bug?

        G
        Garth

        Comment


        • #5
          Hello All,

          getNextTradingDay() does not seem to be working for me either. I will look into this further.

          Thanks,
          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


          • #6
            Hello All,

            Your solution to this problem is to use "rawtime" instead. Try the following.


            PHP Code:
            function main() {
                var 
            ttime getValue("rawtime");
                if (
            ttime == null) {
                    return;
                }

                var 
            next_trade_day getNextTradingDay(ttime);

                if (
            next_trade_day != null) {
                    
            debugPrintln(next_trade_day);
                }

            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
              Interesting, and not very intuitive in that getPreviousTradingDay()
              uses a time object and not rawtime...

              Thanks for letting us know!

              Garth
              Garth

              Comment


              • #8
                It appears that getValue("rawtime") works for both getPreviousTradingDay() and getNextTradingDay() but getValue("time") only works for getPreviousTradingDay(). So, it looks like just switching over to 'rawtime' is a safe choice.

                Chris

                Comment


                • #9
                  Oh cool. Didn't used to be that way. They must be switching things over to use rawtime (which is much lighter weight, so a good thing). Now I can start to mod my older formulas.
                  Garth

                  Comment


                  • #10
                    I will try "rawtime". Does the Date object also put out "rawtime", I did not find a method returning "rawtime".

                    Comment

                    Working...
                    X