Announcement

Collapse
No announcement yet.

Access Multiple Intervals within 1 EFS

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

  • Access Multiple Intervals within 1 EFS

    Hi there,
    Is there anyway I can access members of builtin Study funcionts for one symbol but across multiple intervals from 1 script.
    For example, if the script resides in a 3 minute intraday chart of IBM, can I get hold of say a 20 period MA of 5, 15, and 30 minute intervals? Thanks.

  • #2
    z11
    See this post on this subject by Garth Doverspike
    Alex

    Comment


    • #3
      Multiple Intervals

      Thanks Alex for your prompt reply. I am totally new to EFS. I studied the efs code you referred to....but would you point out to me which lines of code are pertaining to accessing the external intervals for MA calculation? Thank you.

      Comment


      • #4
        z11,

        The point is that there isn't just one or two lines of code. If you are looking at Jason's rather nice EFS you can see that he is does come rather complex things with synching up time of higher interval MA's with the interval that the current chart is displaying. This is currently the only way to do this (If you read my post in the thread Alex referenced it also stated this).

        You can use Jason's code as is to do what you want. You also have the option of just doing a rough equivilant when dealing with MA's. Just take the interval of interest and dive it by the interval of the chart. Take this number and multiply it by the period for the MA you want. Use this number to fill in the MA parameters in the basic study Moving Average.

        ie: If you want a 10 minute 15 period MA on a 5 minute chart:
        10/5 = 2
        15*2 = 30

        So use a 30 period MA and you will get almost the exact same results as if you had plotted a 10 minute 15 period MA.

        Of course this will not work so well for many other indicators, but for MA's it is a simple work around.

        Garth
        Garth

        Comment


        • #5
          Multiple Interval

          Thanks garth...now I see what you mean...unfortunately that won't work for Stochastics and DM studies (and possibly MACD)...so a related question is .... is there anyway to coordinate logic and variables across multiple EFS's residing in charts of different intervals? Thanks.

          Comment


          • #6
            z11,

            With MACD I would suggest just using the builtin MA studies and just supply the correct values (using the formula I gave in the prior message) and then perform the specific MACD calc's off of those MA's. That would be a pretty straight forward EFS.

            For the others it would take doing work similarly to Jason's work to synch up the times. The good news is that the synching logic is Jason's code is relatively portable to another EFS. The bad news is unless you can really understand what he is doing, I don't think it will help. Since the code isn't well commented it may be hard to tell what all is going on for someone who is new to EFS.

            Since the logic for doing this is scattered through out the main() routine it is imposable to point to just a few lines. But if you follow the logic he is working with in regards to newday, and time in general you will see that these are the key lines of code.

            If I had more time, I would attempt to comment the code myself to make it clearer but I am working on a few other critical things at this time.

            Sorry I can't be of more help...but as Both Jason and I say on the thread Alex pointed you to, this is one of the more complex tasks you can take on in EFS.

            Garth
            Garth

            Comment


            • #7
              hi Garth, I read all the related links (posts) more carefully and noticed that in a reply from you dated Oct 2002 that you were working on functionalities that would allow one to retrieve Study values of different intervals as one can with getValue of OHLC. Any news on that? or that effort has been abandoned? Thanks.

              Comment


              • #8
                Z11,

                A point of clarification first. eSignal is working on such an enhancement, and it is wrapped up in a number of other nice enhancements. I don't work for eSignal and am not developing such technology.

                Now to the question at hand: I am hoping that this functionality has not been abandoned by eSignal as I view it is critical for many users. It has been a very long time since the initial alpha for this functionality was released, and there has been some enhancements since then, but it is still not ready (at my last look) for prime time.

                However, it will take someone from eSignal such as Jason, Dion, Andy, Scott, Duane or some other eSignal employee who is a regular poster to this BB to comment on eSignals planned release dates (if any).

                Garth
                Garth

                Comment


                • #9
                  Hello Z11,

                  This functionality Garth refers to is part of EFS2, which will allow us to do multiple time trame studies in a much simpler way. It has not been abandoned. If fact, there has been significant progress made. However, we do not have any specific release dates set for when it will be made available. It's possible, but don't quote me on this, that some portions of EFS2 will be available in the one of the next few releases. We'll have to wait and see.
                  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


                  • #10
                    Might I jump in here..

                    As a side note... there was a post a while back where Alex and I illustrated a method of writing information to a file (indicator values), then reloading the file information into charts with different time frames. I've used this feature many times to solve problems where clients want (for example) 5 minute MAs to show on a 2 minute chart - or 20 minute Bollinger Bands on a 5 minute chart.

                    With a little work, you should be able to get as many indicators as you like into any charts you like using this feature.

                    I don't know where the post is (it was many months ago), but I have some sample code if you want to see it work..

                    B
                    Brad Matheny
                    eSignal Solution Provider since 2000

                    Comment


                    • #11
                      hi Brad...interesting idea ... I'd love to take a look at your sample codes using files as the intermediary for information storage...Thanks.

                      Comment


                      • #12
                        Here you go...

                        Here is the "Writer" code (that creates the file)... This code creates a filename like "ES_YourSystem_5.txt" This way, you know what system created this file and the time interval.

                        PHP Code:
                        function fWriteFileOut(tOutString) {
                          var 
                        PosCount 0;
                          var 
                        FileName null;

                          
                        tSymbol ""+getSymbol();
                        PosCount tSymbol.split(" ");
                          if (
                        PosCount) {
                           
                        FileName ""+PosCount[0]+"_YouSystem_"+getInterval()+".txt";
                          } else {
                           
                        FileName ""+getSymbol()+"_YouSystem_"+getInterval()+".txt";
                          }

                          var 
                        = new File(FileName);
                           if ((
                        NewLoad)) { 
                             
                        f.open("wt+");
                                
                        f.write(tOutString);
                             
                        f.close();
                             
                        NewLoad false;
                           }
                           if ((!
                        NewLoad)) { 
                             
                        f.open("at+");
                                
                        f.write(tOutString);
                             
                        f.close();
                           }

                        In your main() function... you want to add the following line to tell the function to write the information. You must also include a DATE/TIME marker..

                        PHP Code:
                        LastDateTime getValue("rawtime"0);
                        fWriteFileOut(""+LastDateTime+","+IND1Value+","+IND2Value+"\n"); 
                        Now, the READER portion of the code (that goes into your analysis system..

                        PHP Code:
                        function fReadFileOut() {
                          var 
                        PosCount 0;
                          var 
                        FileName null;
                          var 
                        line "";

                          
                        tSymbol ""+getSymbol();
                        PosCount tSymbol.split(" ");
                          if (
                        PosCount) {
                           
                        FileName ""+PosCount[0]+"_YourSystem_5.txt";
                          } else {
                           
                        FileName ""+getSymbol()+]+"_YourSystem_5.txt";
                          }
                        //  debugPrintln(FileName);
                          
                        var = new File(FileName);
                           if (
                        f.exists()) { 
                             
                        f.open("rt");
                              while(!
                        f.eof()) {            
                                
                        line f.readln();
                                if (
                        line) {
                                 
                        PosCount line.split(",");
                                 if (
                        parseFloat(PosCount[0]) == getValue("rawtime"0)) {
                                
                        //  debugPrintln(line);
                                  
                        IND1ValueparseFloat(PosCount[1]);
                                  
                        IND2ValueparseFloat(PosCount[2]);
                                 }
                                }
                              }
                             
                        f.close();
                           }


                        The way I do it is... everytime there is a new bar, I call fReadFileOut(). You could do it with every tick if you wanted..

                        Another trick is to keep the files short (I do this by setting a time template to about 300~500 bars). This makes everything work fast and prevents delays from reading a file with umpteen thousands of recorded bars of data that are not needed.

                        Hope this helps..

                        B
                        Brad Matheny
                        eSignal Solution Provider since 2000

                        Comment


                        • #13
                          Producer/consumer using global variables

                          When I'm using eSignal, I consolidate or refer to multiple timeframes from a chart by using global variables. This uses setGlobalValue and getGlobalValue for communication globally within a process.

                          Set up charts running the efs of interest, each having its own timeframe.

                          Then have each of these charts publish a named data value to a global variable, associated with a timeframe.

                          Each chart periodically does this:
                          setGlobalValue("MyData"+getInterval(),dataValue);

                          These are the "producers" of data. Then have a "consumer" chart, which grabs data and displays each one as, say, a line chart; or which combines the data. This chart has knowledge of the intervals available.

                          If you contemplate using this technique, keep in mind that global variable names must be *unique* within a process. So long as you maintain that uniqueness, you'll be fine.

                          The "consumer" of this data will look up global data values by doing getGlobalValue("MyData"+intervalOfInterest);

                          This is a crude but effective inter-chart communication mechanism, where each chart is assigned the task of publishing data on its own timeframe, and a consumer chart uses these data values in any way it chooses to.

                          If that produces a non-null value, then use it.

                          Just another way of doing it...

                          If you do this, then also use the postMain() function in the producers which will remove these global values from the namespace:

                          function postMain() {
                          removeGlobalValue("MyData"+getInterval()); // cleanup
                          }

                          Comment


                          • #14
                            Thanks Brad for sharing your code on the file idea.

                            Comment


                            • #15
                              hi bfry5282, it turns out that is exactly the way I have chosen to deal with this issue. However, I am not sure how to keep arrays of these globalvalues from different intervals within the "consumer" EFS. I have chosen the "consumer" chart having the shortest interval of all Producers intervals ...so the consumer will be pulling these global values across the board faster than the end of Producer intervals...so how do I synchronize and then store each new values in each respective arrays (each array represents 1 interval's globalvalues, for example.) Thanks guys.

                              Comment

                              Working...
                              X