Announcement

Collapse
No announcement yet.

How to calculate the remainder?

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

  • How to calculate the remainder?

    Hi,

    tried to get the restseconds of a bar, but don't find how to use the %.

    I tried

    rest = %getMinute()/getInterval() *60 - getSecond();
    Doesn't work.

    rest = %(getMinute()/getInterval()) *60 - getSecond();
    Also doesn't work.

    Please help

    Regards
    Robert

  • #2
    Here is an efs that calculates the remaining time in the bar. http://share.esignal.com/download.js...ingBarTime.efs

    Regarding percentage, you have to divide the time remaining by the bar time, then multiply by 100 to get percentage. The percentage functionality you are trying does not work based on what I have seen.

    Regards,

    Comment


    • #3
      % is a javascript command - called the modulo operator.

      5%4 = 0.25 because 5/4=1.25 and only the fraction remains.

      Comment


      • #4
        FWIW, to find the efs, I selected the search button and entered the following in the eSignal Bulletin Board Search Engine, Search By Keyword basic query: remaining time in bar


        edit:
        Dave, hmm...the modulo operator, as I remember (it's coming back), don't you use that quite a bit? Thanks again for the clarification.

        Regards,

        Last edited by Guest; 05-04-2004, 10:01 AM.

        Comment


        • #5
          Thank you both steveshare2003 and dloomis.
          This answers my question.
          Seems that getInterval() doesn't return minutes. so i have to add some kind of a factor.
          getValue("Time") as used in the proposed efs is described as very cpu consuming, therefore i didn't want to use it.

          So basically i have an efs that does what i want and i have a description of how to use this %.

          Thank you again.

          Bye

          Comment


          • #6
            I have previusly tested the difference it takes between using the date object and getting bar time

            http://forum.esignal.com/showthread....arth#post30983

            Interesting reading IMHO. Undertand that if you are using the date object for this measure, you just need to be careful. If you are not running a number of demanding efs's it will not have any impact on performance. Just be aware, that using the date object often in a large number of efs's can have a negative impact on performance. Per my test, calling the date object 10,000 times took 4.5 seconds. Not a big deal. If you have the same call in 15 efs's and the market opens on an active symbol, you may see performance delays.

            Bottom line, use the date object, it is a great tool. Just use it in moderation.

            Regards,

            Comment


            • #7
              Thank you Steve,

              so i don't have to care about it. I would only have one efs that uses it.

              Regards
              Robert

              Comment

              Working...
              X