Announcement

Collapse
No announcement yet.

Time Template Info

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

  • Time Template Info

    Hi,

    Is there any way to get the time template info into an EFS? I know I can't set it from an EFS (though I sure think that would be a nice feature), but is it possible to get it?

    If not, I guess I will be reduced to doing a getFirstBarIndex of day and getting the time info from there, then subtract one bar and get the time info from that bar. The problem with this approach is I have to make sure I do it in the right places...sometimes the first bar index of a day will not really be the start of the day...

    Garth
    Garth

  • #2
    Garth,

    Try getInterval(), this works well.

    PHP Code:
    var sInterval getInterval();//debugPrintln("sInterval = "+sInterval); 

    Comment


    • #3
      Hi Steve,

      Thanks for the reply, but what I want is the TT info...like start and end times for a day and the number of bars loaded.

      Clearly getting the number of bars loaded isn't a problem...but getting the start and end times is a bit more difficult, and without the time template I can't think of a really clean way to do it.

      Garth
      Garth

      Comment


      • #4
        Garth,

        Ok, I see ... have you tried any of these functions, you may be able to kludge something together with them that works (may suffer from same limitations as you mentioned in your previous post). Certainly, a separate function that returns the info which you want plus other info such as chart style would be nice and much cleaner.

        getNewestBarIndex()
        getInterval()
        getNextTradingDay()
        getNumBars()
        getOldestBarIndex()
        getPreviousTradingDay()



        Regards,

        Comment


        • #5
          Howa about using getDay() and if getDay()!=getDay(-1) then start counting bars for the new day, then figure out what time it is now and back calculate the time of the first bar?

          Comment


          • #6
            David,

            getDay() and if getDay()!=getDay(-1)
            When will getDay() ever be equal to getDay(-1)? I'm trying to understand what this conditional check buys me...

            Garth
            Garth

            Comment


            • #7
              Steve,

              Yes, I was planning on using getOldestBarIndex() to get the total number of bars loaded.

              The idea of using getNextTradingDay() is a good one I think. I can start off using that and use the date object returned in my getFirstBarIndex() of day (in that way I will make sure I have a full day of data). Then grab the time from there. In theory, then that index value -1 will be the end of the day (according to the chart) of the previous day.

              That should work I think...Thanks for the idea, I had forgotten about getNextTradingDay().

              Of course, the question is, what happens is the day in question is a short trading day for some reason. I may need to do this twice to verify my data, and if it doesn't match do it a third time as the quorum.

              Garth
              Garth

              Comment


              • #8
                Garth
                It would seem that getDay()!=getDay(-1) only on the first bar of every day
                Alex

                Last edited by ACM; 10-18-2003, 03:50 PM.

                Comment


                • #9
                  Alex,

                  So the code that draws the lines does so what getDay() == getDay(-1)?

                  Very odd indeed that getDay() would ever equal getDay(-1) (logically that says that the current day == the last day, which might be nice if yesterday was a really good day ;-).

                  OK, so that might be a good conditional check to verify that my getFirstBarIndexofDay() - 1 is really the last bar of yesterday...

                  Thanks Alex and Dave for another possible piece...

                  Garth
                  Garth

                  Comment


                  • #10
                    Garth
                    The code that draws those lines is

                    if(getDay()!=getDay(-1))
                    setBarBgColor(Color.lightgrey);

                    As to the request for an enhancement I would suggest having a setSessionStart() and setSessionEnd() given that we already have a isInSession() as of now. That would free the system from the Time Template
                    Alex

                    Comment


                    • #11
                      Garth

                      getDay() returns the day of the current bar.

                      getDay(-1) returns the day of the previous bar.

                      Sometime between the close and open getDay() != getDay(-1), this can only be the first bar of the day.

                      Sif this is the first bar of the day, check the time on this bar and the previous bar with getMinute(), now you have the start and end time of the time template.

                      Then you can use getInterval() to figure out how many bars have been drawn - or start counting bars since the template started today.

                      Comment


                      • #12
                        David, Alex,

                        OK, Got it...I was suffering some brain problems obviously.

                        I think combining these things will work...off to code now.

                        Thanks!

                        Garth
                        Garth

                        Comment

                        Working...
                        X