Announcement

Collapse
No announcement yet.

How to lower the overhead?

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

  • How to lower the overhead?

    In my efs, I calculate fast and slow stochastics through calling study.getValue(). The function oneSecondHasElapsed() is defined to make sure the vFast and vSlow are only calculated every one second or longer. My question is when I apply this efs to stocks like SPY and QQQ, shall StochStudy be still called whenever new tick comes? I checked the document on the difference between call() and callFunction(). I guess in the implementation of StochStudy, call("\library\StochasticLL.efs") is used. Thus I am wondering whether my oneSecondHasElapsed() can effectively limit the computation overhead. This question may be of little concern to most users. However, because my system is quite complicated, I am trying to sqeeze out all unnacessary overhead. Otherwise in some busy time period, the esignal would halt due to being overwhelmed by large number of imcoming tick data.


    function main() {

    if ( oneSecondHasElapsed() == true ) {
    var vFast = StochStudy.getValue(StochStudy.FAST);
    var vSlow = StochStudy.getValue(StochStudy.SLOW);
    }
    .......

    }

  • #2
    I would put a debugPrintln statement in the then part of the if and also print the time to see if you are getting the delay you are looking for.

    I think your idea should work.

    Comment


    • #3
      no. There seems no way I can find out how StochStudy works ( is its main() function called whenever a new tick data comes in or not ), although I am sure StochStudy.getValue(StochStudy.FAST) is executed about every one second.

      Comment


      • #4
        Are you saying

        StochStudy.getValue(StochStudy.FAST);

        is getting calculated independently of the

        if ( oneSecondHasElapsed() == true )

        ?

        Comment


        • #5
          IT is what I want to know. It would be even worse some other efs' (i.e. in the implementation of StochStudy ) are called independent of the
          if ( oneSecondHasElapsed() == true )

          Comment


          • #6
            Still not sure I understand but here is my 2 cents

            var vFast = StochStudy.getValue(StochStudy.FAST);
            var vSlow = StochStudy.getValue(StochStudy.SLOW);

            only get evaluated if

            if ( oneSecondHasElapsed() == true ) {

            is evaluted as true.

            if ( oneSecondHasElapsed() == true )

            is evaluated every tick. If it tests false, javascript does not evaluate the code in braces.

            Comment

            Working...
            X