Announcement

Collapse
No announcement yet.

how frequent is a stidy got updated while computing on close?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • how frequent is a stidy got updated while computing on close?

    If I set an EFS compute on close and in this EFS there is a builtin study called, for example

    setComputeOnClose(true);
    ......
    var volBBTopStudy = upperBB(20, 2, volume(sym(volSymbol)));
    ......

    My question is whether volBBTopStudy is updated on every tick of volSymbol or it is only updated at the end of each bar of the primary symbol? Thanks in advance.


    - Clearpicks

  • #2
    interesting question.. I would assume the EFS is only run at the close of the bar, but the return values of the STUDY may be updating with every tick - then again... maybe not.

    I would try to use the debug output to see if I could identify any value changes to the study. You might have to try to do this with two files or an efsLibrary.
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      Hello Brad,

      Have you found the answer? Maybe someone from eSignal developer team could give an answer directly without trying to reverse engineer how esignal implements this.

      - Clearpicks


      Originally posted by Doji3333
      interesting question.. I would assume the EFS is only run at the close of the bar, but the return values of the STUDY may be updating with every tick - then again... maybe not.

      I would try to use the debug output to see if I could identify any value changes to the study. You might have to try to do this with two files or an efsLibrary.

      Comment


      • #4
        Hi
        Not quite sure I understand the question here, but see Jason's answer in thread "multi-interval NEWBAR sync query (ComputeOnClose())", does that sound applicable?
        If not please explain what you are asking!

        Dave

        Comment


        • #5
          The purpose of setComputeOnClose(true) is to save some CPU time. However if the internal study called is still updated on every tick, for example, calculateing the bollinger bands on every tick, the potential CPU time saving by setComputeOnClose(true) is less than the case when bollinger band study is only updated once at the bar close.

          Regarding to the syncronization of multi time frame, I think this is a potential big problem, so is the syncronization between primary efs and builtin studys and efs libraries being called by the primary efs.

          Besically esignal script engine should update all related bar status, internal study sequence and efs libraries before the customer efs main() function being called.

          - Clearpicks


          Originally posted by Dave180
          Hi
          Not quite sure I understand the question here, but see Jason's answer in thread "multi-interval NEWBAR sync query (ComputeOnClose())", does that sound applicable?
          If not please explain what you are asking!

          Dave

          Comment


          • #6
            OK, see what you mean about whether or not the internal study is called on every tick, or not, apologies, not seeing clearly there.

            Seems to me unlikely it is called very tick, but who's to say for sure - as eSignal won't tell us.

            As for the multiple interval sync problem, this is a more a waste of time than a disaster for me at the moment, in one instance I was looking at mas based on other intervals, and I guess they won't be affected much (as the ma at the end of the just-closed bar (the ma I expect to read) is not much different to that based on the first tick of the new bar (the one I guess I am reading) for a liquid market).

            BUT when you want to look at something that happens as the start of the candle (like the time), you suddenly start to question your sanity. I've written a bodge to decide which candle is which for now.

            And of course finding (see the third post) that the values of the close() are not all equal across all intervals is simply not fathomable.

            Comment


            • #7
              Re: how frequent is a stidy got updated while computing on close?

              Hello Clearpicks,

              Originally posted by clearpicks
              If I set an EFS compute on close and in this EFS there is a builtin study called, for example

              setComputeOnClose(true);
              ......
              var volBBTopStudy = upperBB(20, 2, volume(sym(volSymbol)));
              ......

              My question is whether volBBTopStudy is updated on every tick of volSymbol or it is only updated at the end of each bar of the primary symbol? Thanks in advance.


              - Clearpicks
              Yes, any series, such as upperBB() or one created with efsExternal() is being updated on every tick of the data stream it is dependant on.

              setComputeOnClose() was created prior to EFS2. The reason it was created was to help simplify a logic problem that many novice coders were running into. Its primary purpose was not intended to address CPU usage. The problem was that novice coders were creating conditions that evaluated bar 0 in real time, which could generate multiple signals when evaluated on a tick-by-tick basis. In order to change their formula logic to only allow one signal or alert per bar, they needed to incorporate some additional logic, which was outlined in the following formula example, AlertOncePerBar.efs. This was a little too complicated for some users, so setComputeOnClose() was born.

              All this function does is force the formula to only process main() once per bar as each bar is closed in real time. It forces the formula to wait until then most recent bar 0 that just closed is moved to the bar index -1 position and then executes main() and plots the results. This is why there is no data series plotted on bar 0 when this function is present.

              setComputeOnClose() does not have any influence on series objects algorithms. They are still being updated by the EFS engine based on tick-by-tick data, it is only main() that is prevented from being executed on each tick.

              setComputeOnClose() should not be used currently for multiple-time frame or external symbol dependant formulas. Please use getBarState() and getBarStateInterval() to control code executions.

              The following two scripts illustrate the execution of external interval series and symbol series from within a compute on close formula.

              SeriesExecutions.efs
              SeriesExecCoc.efs

              SeriesExecCoc.efs
              PHP Code:
              function preMain() {
                  
              setStudyTitle("Number of Series Object Executions under COC");
                  
              setCursorLabelName("main() COC"0);
                  
              setCursorLabelName("External Inv Series"1);
                  
              setCursorLabelName("External Sym Series"2);
                  
              setPlotType(PLOTTYPE_HISTOGRAM0);
                  
              setPlotType(PLOTTYPE_HISTOGRAM1);
                  
              setPlotType(PLOTTYPE_HISTOGRAM2);
                  
              setDefaultBarThickness(90);
                  
              setDefaultBarThickness(61);
                  
              setDefaultBarThickness(32);
                  
              setDefaultBarFgColor(Color.red0);
                  
              setDefaultBarFgColor(Color.blue1);
                  
              setDefaultBarFgColor(Color.lime2);
                  
                  
              setComputeOnClose();
              }

              var 
              bInit false;
              var 
              xSeries1 null;
              var 
              xSeries2 null;
              var 
              nCntr 1;

              function 
              main() {
                  if (
              bInit == false) {
                      
              xSeries1 efsExternal("SeriesExecutions.efs"inv("5"));
                      
              xSeries2 efsExternal("SeriesExecutions.efs"sym("YM #F"));
                  }
                  
                  var 
              nExec1 xSeries1.getValue(0);
                  var 
              nExec2 xSeries2.getValue(0);
                  
                  if (
              getBarState() == BARSTATE_NEWBAR) {
                      
              nCntr 1;
                  } else {
                      
              nCntr++;
                  }
                  
                  return new Array(
              nCntrnExec1nExec2);

              Apply the SeriesExecutions.efs to a 5-min chart of ES #F in chart 1. Apply the same formula to a 5-min chart of YM #F. Apply SeriesExecCoc.efs, which is a compute on close formula to a 1-min chart of ES #F. The SeriesExecCoc.efs plots 3 histograms where each is the number of executions of main(), an external 5-min interval series and an external symbol series.

              After allowing these formula to run in real time for a while you will see that the number of executions for the two external series are incrementing based on the number of RT executions of their dependant data streams. Where as main() in the compute on close formula is only executing once per bar.



              Hope this helps shed some light on this topic.
              Jason K.
              Project Manager
              eSignal - an Interactive Data company

              EFS KnowledgeBase
              JavaScript for EFS Video Series
              EFS Beginner Tutorial Series
              EFS Glossary
              Custom EFS Development Policy

              New User Orientation

              Comment


              • #8
                Hello Jason,


                Thank you for the explanation. It seems I need to rewrite some EFS' because any builtin study and efs library are still updated tick by tick, which is not what I want.

                - Clearpicks

                Comment


                • #9
                  Jason,

                  I assume that if you check "Make all formula's compute on close" in the Formula Settings Dialog box, that this works exactly the same as if you had setComputeOnClose(true) set on all of your EFS studies...and that called series functions would still run tick-by-tick?

                  Garth
                  Garth

                  Comment


                  • #10
                    Jason,

                    If my efs creates a study series of another symbol, for example

                    var myStudy = null;
                    var bInit = false;

                    function main() {
                    var myVar;
                    if ( bInit == false ) {
                    myStudy = rsi( 14, sym("AnotherSymbol"));
                    bInit = true;
                    }

                    //retrieve the current value
                    myVar = myStudy.getValue(0);

                    return( myVar );

                    }


                    The myStudy will be updated by efs engine on every tick of "AnotherSymbol" no matter whether setComputeOnClose(true) or setComputeOnClose(false).

                    If in my efs only calling rsi( 14, sym("AnotherSymbol"), -1) once, for example,

                    var done;
                    function main() {
                    if ( getCurrentBarIndex() == 0 && done != true ) {
                    myStudy = rsi( 14, sym("AnotherSymbol,D"), -1);
                    done = true;
                    }
                    }

                    will efs engine still creates and updates a rsi series of "AnotherSymbol,D" on every tick of "AnotherSymbol" although rsi( 14, sym("AnotherSymbol,D"), -1) is only called once? If true, I would like not to use any EFS2 feature or built-in study functions and stick to use getValue() to calculate every indicator by myself.

                    Recently I modified some EFS scripts and within them, quite a few built-in study functions were called on other symbols and intervals, and obvious freezing or slow down was noticed during active trading periods, which I suspect had something to do with how frequent those serieses were updated.

                    - Clearpicks

                    Comment


                    • #11
                      Jason, thanks for the example, but not thrilled by the implementation I'm afraid.

                      Let's move back a step:

                      1) Clearpicks used
                      var volBBTopStudy = upperBB(20, 2, volume(sym(volSymbol)));
                      with the implication being that volVVTopStudy was a static object ("var volVVTopStudy = null;" stated outside of main(){}, I assume)
                      I'm also assuming that once a series such as this is created, eSignal keeps in it a list of objects to update with every tick. pls confirm Y/N for clarity.

                      So, what about creating the series on the fly within each call to main(), ie a temporary variable defined within main(){}? Presumably that gets around the "per tick" overhead as the object does not exist between calls to main()?
                      But introduces a bigger overhead at each main(){} call. What would the overhead be? In relative terms, how many "tick-update CPU units" are equivalent to "one creation CPU unit", of course this may depend a lot on the series type (ma would be worse at recreation than ema one assumes), but some guidance please?
                      I'm thinking that for, say, 5min bars, there may be a lot to be said for temporary variables.

                      2) Could we also be clear what "a tick" is here too please (that is, an EFS call to main()). I've never seen it documented anywhere but I believe that eSignal has two concepts of "a tick":
                      a) For tick, volume and second charts: every trade is a tick
                      b) For minute, hour, day etc: every price change is a tick
                      Y or N pls? And what about P and R bars too please.

                      So much for all the neat optimisation tricks I tried to use in efs!

                      AH, having written the above I see Clearpicks has posed a variation on this theme, well, my static / dynamic distinction is still important I think. so I'll post it anyway.

                      Comment


                      • #12
                        Hello Clearpicks,

                        PHP Code:
                        var done;
                        function 
                        main() { 
                            if ( 
                        getCurrentBarIndex() == && done != true ) { 
                                
                        myStudy rsi14sym("AnotherSymbol,D"), -1); 
                                
                        done true;
                            }

                        In your example, yes, the rsi() call only happens once. However, if you ask for a specific bar index value of -1, myStudy is assigned to that value and not a series object. Also keep in mind that the rsi series has to be initialized in order to return the bar -1 value. I believe that object is removed from memory after main completes.

                        You can certainly revert back to EFS1 logic that existed prior to EFS2, but you have to keep in mind that you'll need to code all of your own synchronization routines for multiple interval/symbol studies. This is a complex task because of zero volume bars for the external symbols and intervals. Your routines will have to do a bunch of looping and comparing time stamps of the the chart bars and the external bars to get everything lined up properly based on time. In my opinion, the extra work you're forcing EFS to do to handle this for you may be more expensive than allowing the EFS2 Series object to do this work for you. It may be six of one, half dozen of the other. You may just need to try it and do a comparison on your own to decide which path works better for you.

                        Regarding chart freezing, this is not caused by EFS, because we have reports from users that experience this without any EFS running. It is a performance issue of the application and our developers are working on improving this aspect in the next couple of releases. EFS can have an affect on the application if someone were to code an endless loop for example. EFS implementation in general is not the source of chart freezing.
                        Jason K.
                        Project Manager
                        eSignal - an Interactive Data company

                        EFS KnowledgeBase
                        JavaScript for EFS Video Series
                        EFS Beginner Tutorial Series
                        EFS Glossary
                        Custom EFS Development Policy

                        New User Orientation

                        Comment


                        • #13
                          Hello Jason,

                          Do you imply that whenever
                          rsi( 14, sym("AnotherSymbol,D"), -1);
                          is called, EFS engine would create a series object, retrieve the bar -1 value of this rsi series, assign it to myStudy and delete this series when exiting main()? So for each calling, rsi series is created and destroyed once, right?

                          Also, according to my understanding, in my first example, the rsi series is created once (via bInit flag) and can be accessed through the global variable myStudy while EFS2 keeps updating this rsi series in the background on every tick. Am I correct?

                          - Clearpicks


                          Originally posted by JasonK
                          Hello Clearpicks,

                          PHP Code:
                          var done;
                          function 
                          main() { 
                              if ( 
                          getCurrentBarIndex() == && done != true ) { 
                                  
                          myStudy rsi14sym("AnotherSymbol,D"), -1); 
                                  
                          done true;
                              }

                          In your example, yes, the rsi() call only happens once. However, if you ask for a specific bar index value of -1, myStudy is assigned to that value and not a series object. Also keep in mind that the rsi series has to be initialized in order to return the bar -1 value. I believe that object is removed from memory after main completes.

                          You can certainly revert back to EFS1 logic that existed prior to EFS2, but you have to keep in mind that you'll need to code all of your own synchronization routines for multiple interval/symbol studies. This is a complex task because of zero volume bars for the external symbols and intervals. Your routines will have to do a bunch of looping and comparing time stamps of the the chart bars and the external bars to get everything lined up properly based on time. In my opinion, the extra work you're forcing EFS to do to handle this for you may be more expensive than allowing the EFS2 Series object to do this work for you. It may be six of one, half dozen of the other. You may just need to try it and do a comparison on your own to decide which path works better for you.

                          Regarding chart freezing, this is not caused by EFS, because we have reports from users that experience this without any EFS running. It is a performance issue of the application and our developers are working on improving this aspect in the next couple of releases. EFS can have an affect on the application if someone were to code an endless loop for example. EFS implementation in general is not the source of chart freezing.
                          Last edited by clearpicks; 02-22-2008, 11:33 AM.

                          Comment


                          • #14
                            -

                            Hello Clearpicks,

                            In the example you posted, no. The event is only happening once, when that condition is true the first time it hits bar 0. For every execution of main() after this, there are no rsi updates. If you make myStudy global and plot the value you will see a flat line.

                            PHP Code:
                            var done;
                            var 
                            myStudy null;

                            function 
                            main() { 
                                if ( 
                            getCurrentBarIndex() == && done != true ) { 
                                    
                            myStudy rsi14sym("IBM,D"), -1); 
                                    
                            done true;
                                    
                            debugPrintln("myStudy= " myStudy);
                                }
                                
                                return 
                            myStudy;

                            Jason K.
                            Project Manager
                            eSignal - an Interactive Data company

                            EFS KnowledgeBase
                            JavaScript for EFS Video Series
                            EFS Beginner Tutorial Series
                            EFS Glossary
                            Custom EFS Development Policy

                            New User Orientation

                            Comment


                            • #15
                              Re: -

                              Hello Jason,

                              If my code looks like

                              var myStudy = null;
                              function main() {
                              if ( getCurrentBarIndex() < 0 && getBarState() == BARSTATE_NEWBAR ) {
                              myStudy = rsi( 14, sym("IBM,D"), -1);
                              debugPrintln("myStudy= " + myStudy);
                              }

                              return myStudy;
                              }


                              Will the series of "IBM,D" be created many times (because rsi( 14, sym("IBM,D"), -1) is called on every OLD bar), or EFS2 is smart enough to reuse the "IBM,D" series already been created?


                              - Clearpicks



                              Originally posted by JasonK
                              Hello Clearpicks,

                              In the example you posted, no. The event is only happening once, when that condition is true the first time it hits bar 0. For every execution of main() after this, there are no rsi updates. If you make myStudy global and plot the value you will see a flat line.

                              PHP Code:
                              var done;
                              var 
                              myStudy null;

                              function 
                              main() { 
                                  if ( 
                              getCurrentBarIndex() == && done != true ) { 
                                      
                              myStudy rsi14sym("IBM,D"), -1); 
                                      
                              done true;
                                      
                              debugPrintln("myStudy= " myStudy);
                                  }
                                  
                                  return 
                              myStudy;

                              Comment

                              Working...
                              X