Announcement

Collapse
No announcement yet.

Real Time of Ticks inside a bar

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

  • Real Time of Ticks inside a bar

    Hi,

    Is there an effective way to get the time of a Tick inside a longer [say 30min] bar?

    If not, can someone point me to some examples of "skipping ticks" in busy times?

    Thank you.
    Mihai Buta

  • #2
    mbuta,

    Do a search for "remainingbartime".
    Excellent book on JavaScript for beginners

    Comment


    • #3
      FibbGann thank you, but [apparently] I am not smart enough to understand.

      I raised the question because getHour/GetMinute/GetSecond [which I tried without declaring Date object] give only one value per bar.

      Now I see in efs spec/help that same functions are used as methods of Date object and I get very confused.

      If I declare Date object, do I get diferent values every new tick?
      What is the diference between Date() and getValue("rawtime")?
      Do I need to re-declare Date every tick [inside main]?
      Can I accesss directly Seconds only?
      Note: I am [really] looking for speed in very busy times, so every instruction counts.

      Are all these explained anywhere? If not, shouldn't they be?

      Thank you.
      Mihai Buta

      Comment


      • #4
        mbuta,

        What exactly are you trying to accomplish or see? I am not understanding what you are trying to achieve exactly.
        Excellent book on JavaScript for beginners

        Comment


        • #5
          Hi FibbGann,

          I want to be able to skip executions [and return previously calculated values] during busy times, when there are way too many ticks to be handled timely and my screen freezes. I think it is a very common issue with complex scripts and many instances.

          During those times, I want to execute main only once per second.

          Counting ticks is not an option, because they are not time related.
          Using volume is not an option because big blocks or at the open the result is distorted.
          I tried "getBarStateInterval", in spite of its high cpu overhead, but the lowest granularity is 1min [or ticks, which I ruled out].
          I tried "getSeconds", but it returns only onle value per bar.

          I am sure there is a way to do it, but efs documentation does not explain it and I am not a Java programmer, so I don't know when/where to look when efs falls short.

          Thank you for trying to help.
          Mihai Buta

          Comment


          • #6
            Hi FibbGann,

            Based on the example [ReamainingBarTime], I came up with the following solution:

            var MyClock = new Date()*1;
            var MySeconds = Math.floor(MyClock/1000) - 60*Math.floor(MyClock/60000);

            Note: According to EfsHelp also
            var MySeconds = MyClock.getSeconds();
            should work.

            The question is: where to declare MyClock to get updated during the bar? In main, every tick, or global var is ok?

            Thanks.
            Mihai Buta

            Comment


            • #7
              Real Time of Ticks inside a bar

              Hi,

              Can someone clarify what is the instruction to find the time of ticks inside a bar and how it should be used?
              If it is explained somewhere in the doc, please point where.
              Thank you.
              Mihai Buta

              Comment


              • #8
                Hi Mihai,

                You need to use the date object (chapter 7 of this link) to get the time difference in real time. You have to create a date object similar to this every tick:

                var today = new Date();
                var miliseconds = today.getTime();


                This will work in real time only. Different techniques must be used if you want to use in Playback, or if for some reason you want bar miliseconds when historical bars are being loaded onto the chart.

                Comment


                • #9
                  Thank you Steve,

                  I will try.

                  Note: If today.getSeconds() gets the right seconds, why people bother calculating them?

                  Mihai
                  Mihai Buta

                  Comment


                  • #10
                    Hi Mihai,

                    Originally posted by mbuta

                    Note: If today.getSeconds() gets the right seconds, why people bother calculating them?
                    I believe what you are referring to is the numerous seemingly similar methods associated with seconds and the date object. Perhaps this Time Functions 08 14 2006.efs code that I had put together a while back (to help me understand) will help you as well

                    Comment


                    • #11
                      Steve,

                      If YOU, a very seasoned programmer, needed examples and tries to understand, that means it is not just my impression that the documentastion given to us is very incomplete [to avoid crap and others] and WE, those who are not at your level stand absolutelly no chance to ever get something meaningful done.

                      Even when I asked for help [willing to pay] nobody responded, "consultants" included!

                      Thank you Steve,
                      Mihai
                      Mihai Buta

                      Comment

                      Working...
                      X