Announcement

Collapse
No announcement yet.

Dropped Connection Check

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

  • Dropped Connection Check

    Is there some way inside of an efs to find out when the data connection is dropped? Also, when it is re-established.

    I'm having problems with my connection and need to reload some charts when this happens or my indicators get skewed and give false readings. Because of my location the only alternative to my isp is a 26k modem.

    Figure I could put in a real-time clock and check how long it has been since a getMostRecent...().

    Any ideas?

  • #2
    Hello Gavishti,

    I don't think there is a way to handle this within EFS alone. An EFS formula only executes when the chart receives an update. Without a connection, the EFS won't execute. Once your internet connection is reestablished, your data manager should also reconnect. If your internet connection is stable, but your data manager is losing connection, you may want to contact technical support and see if they can help trouble shoot.
    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


    • #3
      Jason,

      It is not the Data Manager. It is interference. I am losing packets. If I could get a different connection I would. Supposedly other ISPs will get to me someday. However, they've been saying that for nearly ten years. I'm considering going to satellite, but am concerned about the latency. In the mean time my ISP says they are trying to figure out the cause of the interference.

      What I'm trying to do for now is find out when that re-connect happens so that I can refresh/update my critical chart. I noticed the No Data and OK signs in the lower corner. Thought maybe there was a way to trap those. Thought maybe they set a flag I could check.

      My understanding is that the efs only updates on a tick. If there is no tick there is no update to drive the code.

      At this point I think that I may be stuck with the getMostRecent idea. It should work, but is a little clunky given what I actually want to do. Would be better to have a function that let me know my data is old instead of guessing based upon latency of getMostRecent.

      Maybe that could be added to the wish list. Perhaps something that told how long since last connection.

      if (getLastConnect() < Xseconds) refresh;

      Thanks

      Comment


      • #4
        Hello Gavishti,

        Here's an idea for you to try that's similar to your idea. On each execution of main, set a global variable using the setGlobalValue(sName, vValue) function and store the time at the end of main(). Then at the beginning of main() do a comparison with the current time to your global variable time using getGlobalValue(sName) and if Xseconds has been exceeded reset the last execute time and then call reloadEFS(). Be sure to reset the last execute time before calling reloadEFS() because none of your code after that call will execute, which could create an endless loop. Below is a basic code example to test. We may need to tweak with this a little bit, but in theory it should work. The default Xseconds is set to 20, so you may need to adjust that number via "Edit Studies" based on the symbols you test with. Let me know how it goes.

        PHP Code:
        function preMain() {
            
        setPriceStudy(true);
            
        setStudyTitle("Reload Example");
            
        setShowCursorLabel(false);
        }


        function 
        main(Xseconds) {
            if (
        Xseconds == nullXseconds 20;
            var 
        vDate = new Date();
            
            var 
        vLast getGlobalValue("LastExecute");
            if (
        vLast != null) {
                var 
        vSeconds = ((vDate vLast)/1000);
                
        //debugPrintln( vSeconds.toFixed(2) );
                
        if (vSeconds Xseconds) {
                    
        debugPrintln("RELOADING EFS");
                    
        setGlobalValue("LastExecute"vDate);
                    
        reloadEFS();
                }
            }
            
            
        /****
            
                Your formula code here
                
            ****/
            
            
        setGlobalValue("LastExecute"vDate);
            return;

        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


        • #5
          I came up with something similar. Currently running a test to see how long to allow before forcing the reload.

          I didn't use setGlobalValue(). Don't understand why I would need to do that versus just declaring a variable within the efs ahead of main(). What would be the advantage of using setGlobalValue()?

          Am I correct that an efs is updated only on a Trade Tick? That implies that Bid and Ask Ticks are relative to the last trade. Which means that if there were five bid ticks between trades I would only get the last one.

          Given that my problem is missing data, will reloadEFS() force a call to the server? I also saw repaintChart() but assume that is related only to draw....() functions. Wasn't able to find anything else that looks close to what is needed.

          Do you have any info that you can share on how long the Data Manager can wait before it declares itself as having missing data? Is the Data Manager pulling or waiting for pushes from the server? From what I see it looks like it is pulling. I am assuming that in your design you allow for a limited number of missed packets. Communications are never 100%. We always built in several attempts before declaring an error. Also noticed that you have automatic reconnect. Problem is that you don't seem to update the data at the client. Or maybe it is just that the chart isn't getting the updates without running reloadEFS().

          Thanks for your help on this.

          Comment


          • #6
            Hello Gavishti,

            Using global variables within the EFS should work fine also. That would be more efficient as well. The only additional advantage of using setGlobalValue() is that the value will remain in memory for the life of the current session of eSignal. It won't be cleared until you shut down eSignal or use the removeGlobalValue() function.

            Your understanding of the updates to a chart is correct. The chart only updates with a new trade. Changes in Bid/Ask only send an update to the advanced chart with a "T" interval.

            Your Data Manager questions are a bit beyond my expertise I'm afraid. I'll try to get someone from our development to provide some details for you.
            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


            • #7
              I've been thinking about this issue. If I have a dropped connection, all of my charts and indicators are out of whack. Perhaps the approach is to stick the clock in its own efs and set a flag using setGlobalValue() that all the other indicators on the chart can check so that they will know to reload also. Problem is how does the chart (bars) know to reload?

              Regarding the efficiency of setGlobalValue(). Are you saying that a variable global to the entire eSignal application is more efficient than one just global to the efs? I understand that placing the declaration inside of main() causes it to be evaluated on each pass. Thought that putting it up at the top before preMain() and main() kept it from being evaluated on each pass. Some tests I have run tend to indicate that to be the case.

              Comment


              • #8
                Hello Gavishti,

                I received some more information in regards to your Data Manager questions from development.

                Do you have any info that you can share on how long the Data Manager can wait before it declares itself as having missing data? Is the Data Manager pulling or waiting for pushes from the server? From what I see it looks like it is pulling. I am assuming that in your design you allow for a limited number of missed packets. Communications are never 100%. We always built in several attempts before declaring an error. Also noticed that you have automatic reconnect. Problem is that you don't seem to update the data at the client. Or maybe it is just that the chart isn't getting the updates without running reloadEFS().
                When the DM encounters a break in connection, it will automatically reconnect with in 20 seconds to a minute depending on the socket error. The software handles connections to the tick servers, which builds the historical bars. The DM delivers the real time data to update the charts. So upon reconnect, the software should reload the chart and fill in the missing history according to development. If not, the code example I provided earlier should force the chart to reload the missing history. The DM gets data pushed to it. eSignal also gets data pushed to it from the DM (real time updates). The initial updates come from the tick servers. Once the initial update is complete, data gets pushed to the chart from the DM.

                I've been thinking about this issue. If I have a dropped connection, all of my charts and indicators are out of whack. Perhaps the approach is to stick the clock in its own efs and set a flag using setGlobalValue() that all the other indicators on the chart can check so that they will know to reload also. Problem is how does the chart (bars) know to reload?
                The only way I could think of to tell the chart to reload is with the code example I posted earlier.

                Regarding the efficiency of setGlobalValue(). Are you saying that a variable global to the entire eSignal application is more efficient than one just global to the efs? I understand that placing the declaration inside of main() causes it to be evaluated on each pass. Thought that putting it up at the top before preMain() and main() kept it from being evaluated on each pass. Some tests I have run tend to indicate that to be the case.
                No, using setGlobalValue() in general is less efficient than using a global variable within an EFS formula. Placing the setGlobalValue() routine outside of main() in the global scope would be a more efficient then placing it inside main() but it needs to be inside main. Every time the EFS executes, main() is called. We need to set the "LastExecute" time to the last time the formula ran. If you only used the routine outside of main, "LastExecute" would only be set to the time the formula first loaded, which isn't what you want. Hope this helps.
                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


                • #9
                  Jason,

                  Regardless of what the development guys say, the bars are not getting updated. That is why my indicators get out of whack. I've watched and there are gaps that fill in when I do a forced refresh (clicking the OK in the cursor window). The gaps are not being filled in when the system does the reconnect.

                  Is there a function similar to the forced refresh? That is what I really need instead of just reloading the efs. Maybe I am misunderstanding what reloadEFS() does.

                  Found under Refresh Button in the eSignal Help topics:
                  Click the Refresh button to reload the current page, refreshing any content that has changed.

                  That is what I want to do in my efs.

                  Thanks for the info on the DM. That helps me understand what is going on. The answer implies that the DM should know how long it has been disconnected so that it can tell the server how much data is needed. But there does seem to be a glitch in the system.

                  Comment


                  • #10
                    Hello Gavishti,

                    The reloadEFS() function would be the closes thing we have in EFS to a manual refresh. I'm not positive that it will fill in the gap of missing data when called. You should be able to use that code example I gave you as is to test it. When the reloadEFS() function is called it will print a message to the output window to let you know. This should occur after the DM reconnects. Try it out and let me know if the data gap gets filled in. I'll let development know what you are experiencing with the reconnects in the mean time.
                    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


                    • #11
                      OK Thanks

                      Comment


                      • #12
                        Jason,

                        I've been experimenting with the manual refresh and reload. That is Ctrl-click of the OK in the Cursor Window and using the reload from the right-click menu. The refresh retrieves the missing data, the reload does not. I haven't built the reloadEFS() into a script yet, but figure it will work the same as the option on the menu.

                        So, here is a request. Please add a function refreshChart(). I will also send an email to suggestions.

                        Thanks.

                        Comment


                        • #13
                          Jason,

                          Didn't know how to send these images other than in this forum. This is so the development guys have something to work from. Three snapshots showing at time of disconnect, how the DM missed some of the data, and what it should have looked like. The chart is for YM #F on a 1 minute interval.

                          Please ask them to figure out what is going on and fix this problem. Surely, I am not the only one experiencing the problem. It is just that my connectivity problem accentuates the issue.

                          Thanks.
                          Attached Files

                          Comment


                          • #14
                            After the DM re-connected. Notice the gap.
                            Attached Files

                            Comment


                            • #15
                              After doing a manual refresh (Ctrl-Click of server status in cursor window). This shows the data that the DM missed.
                              Attached Files

                              Comment

                              Working...
                              X