Announcement

Collapse
No announcement yet.

Time functions

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

  • Time functions

    Hllo Jason,

    Some time ago (years) you helped me develop this simple efs, which draws on 24 hour stock index charts lines indicating yesterdays close and the overnight high and low. I find these pivot points important when analysing historical charts. But it can take hours to load a 30 day chart with 5 minute bars, with the cpu churning away at 100%. Is there a more efficient way of doing this?

    I have replaced the original time functions, etc., with the newer efs 2 ones. The original code doesn't work at all.

    Xenophon
    Attached Files

  • #2
    Made some changes for modern eSignal versions, its output looks correct. Possible speed improvement by not doing var declarations in main() each loop.

    Comment


    • #3
      preview post seems to cause loss of an attachment
      Attached Files

      Comment


      • #4
        Time functions

        Thanks, DavidZ. If there are no other better eSignal time functions, then I seem to be out of luck. I've attached some further optimization.

        Who would have thought that such a conceptually simple function could be such a cpu hog? I am also using Heiken Ashi bars on my chart, which doesn't help;

        Regards,

        Xenophon
        Attached Files
        Last edited by Xenophon; 11-07-2006, 06:13 AM.

        Comment


        • #5
          Concerning speed of executon:
          Read Alexis post and follow reference to JasonK answer



          I'm not running the latest version of eSignal on this machine, so don't know if changes made to functions yet.

          Comment


          • #6
            Attached version handles tracking the overnight highest-high and lowest-low in a less cpu-intensive fashion so it should be a bit faster. Pulling this script into a 30-day 24-hour chart on my end takes less than a second to load (and the original version was not that much worse). The point being that if you are having resource problems, you may need to look at some of other indicators/scripts that you are running.

            Chris
            Attached Files

            Comment


            • #7
              Time functions

              Thank you, Chris, for that elegant bit of code. It has made a vast improvement. I realize now that all the charts I have problems with (eg., color variables, eSignal crashes, etc.) use time and other functions, and were trouble free before eSignal 8. I will revert back to version 7.

              Xenophon
              Darius

              Comment


              • #8
                Time functions

                For your interest, Chris, I attach some further improvements to the overnight H/L/C indicator. 90% of the getMinute calls are eliminated by executing them only when the hour is 9 and 16, and the "if (tmpH != null) ..." loop need only be done within the NEWBAR loop. The BarCounter code is redundant.

                My conclusion is that getMinute, and presumably other "get" functions are very cpu intensive and should be executed rarely. This appears to be a special problem for eSignal 8.0. I hope the developers are aware of this performance issue.

                As my charts also use the CCI and Heiken Ashi indicators, there are many "gets". I can merge these indicators to eliminate a few of these: one "get" can provide information for multiple purposes. My problem now is eliminating unwanted cursor window labels. I want some of these but not all. I know that returning a string will give me a value in a cursor label without plotting it. How can I plot a value (eg., Heiken Ashi bar data) without it appearing on my cursor window label? setShowCursorLabel(false) doesn't help because I want some labels to appear.

                Xenophon
                Attached Files

                Comment


                • #9
                  Thanks. What you mention about 8.0 vs older versions of eSignal is strange, though, because I have not seen any appreciable difference in performance on my end (I'm on 8.0 Build 782 and have worked my way up over the years from early versions of 7.0).

                  Regarding the plot issue...as far as I know you can display values in the cursor window without plotting those values on the chart but you cannot do the reverse (i.e., plot values in the chart but remove them from the cursor window) unless, as you mentioned, you turn off all of the labels using setShowCursorLabel().

                  Chris

                  Comment


                  • #10
                    Xenophon

                    My conclusion is that getMinute, and presumably other "get" functions are very cpu intensive and should be executed rarely
                    getHour() and getMinute() are more resource intensive in the context of your script when using eSignal 7.91 or higher because they are now creating a series and then retrieving the current value from it instead of just retrieving the specific value.
                    Many efs functions [like those mentioned above or close(), high(), etc] now have enhanced capabilities such as for example the ability to access data across multiple intervals or external symbols and while they will still work when written using the legacy efs1 syntax (for backwards compatibility reasons) it is preferable to use the appropriate efs2 syntax so that they will run in their most efficient way.
                    Replace getHour() and getMinute() with getHour(0) and getMinute(0) - as shown in Chris' and David's examples - and you will see that those functions and consequently your script will be considerably more efficient
                    Alex

                    Comment

                    Working...
                    X