Announcement

Collapse
No announcement yet.

intern hlc3 function 5 times faster than own

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

  • intern hlc3 function 5 times faster than own

    hi,

    why is

    PHP Code:
    function main()
    {
     return 
    hlc3();

    5 times faster than my own function?

    PHP Code:
    function main()
    {
     return 
    myhlc3();
    }

    function 
    myhlc3()
    {
        return (
    high() + low() + close())/3;


    How can I speed up my own functions like above example?
    Franz

  • #2
    Franz
    Use the values instead of the series [ie high(0) instead of high()] to perform the calculations in the function
    Alex

    Comment


    • #3
      Alex,

      thank you very very much for your posting!
      The EFS Performance Monitor loves it.


      I unterstand now, that high() is a series, because of an internal eSignal-study, but why is myhlc3() not a series, if I call it in the same way like the high()?
      Franz

      Comment


      • #4
        Franz
        myhlc3() is a call to a function which returns the result of a calculation and not a series object.
        If you want to create a series of that return then you would need to use efsInternal() to call the function. For example var myVar = efsInternal("myhlc3");
        Alex


        Originally posted by franzmey
        I unterstand now, that high() is a series, because of an internal eSignal-study, but why is myhlc3() not a series, if I call it in the same way like the high()?

        Comment


        • #5
          Ok, I thought only, because it worked with an example of my tests today...

          With next code, I get a series:
          PHP Code:
          function main()
          {
              return 
          sma(14abc());
          }

          function 
          abc()
          {
              return 
          close();


          and with next code not.

          PHP Code:
          function main()
          {
              return 
          sma(14abc());
          }

          function 
          abc()
          {
              return 
          close(0);

          Franz

          Comment


          • #6
            Franz
            That is because in the first example the function is returning a series whereas in the second it is returning a value.
            Keep in mind that when you process a series ie you do (high()+low())/2 the result is not a series but a value.
            Alex

            Comment

            Working...
            X