Announcement

Collapse
No announcement yet.

System Crash on eval() function

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

  • System Crash on eval() function

    Hi EFS Support Specialists,

    Can you tell me where to find more info on eval() function? It used to be in the EFS Refence, but cant find it anymore.

    What is wrong with the following two lines:
    var PlotColor = "Color."+"grey";
    setBarFgColor(eval(PlotColor), 2);

    I get systematic system crash (sent you many reports).
    Same two lines work in many other places.
    If I comment out the line with eval, or if I replace eval() with simple Color.xxx works again.

    Thank you!
    Mihai
    Mihai Buta

  • #2
    Mihai
    Try doing a Search for eval and set Show results as posts.
    You should find a few posts one of which explaining the function
    Alex

    Comment


    • #3
      Thank, but there is nothing there. They talk about other ways of evaluation (or I did not see).

      eval() used to be in EFS Reference.
      Is it out? eval() is not a valid function anymore?
      And if it is, why it is not explained? Why do we have to look for other posts?

      And why the same two lines work on many other places but not here? What is it particular (or peculiar) with eval function???
      Mihai Buta

      Comment


      • #4
        Strange, very strange.

        I put those two lines in function which I call and works.
        I move them anywhere in the body of main and system crashes systematically.

        I will see how it behave in other indicators, because the purpose was to eliminate calls and setBarFgColor/Thickness, CursorLabel as much as possible, because they slow down considerably the system (when changing Symbols in several charts).

        Note: I have those in my standard return routine, where I can easily change the plots based on input parameters (what and how to display).

        If anybody interested, I can send.

        Thanks,
        Mihai
        Mihai Buta

        Comment


        • #5
          Mihai

          eval() used to be in EFS Reference.
          Is it out? eval() is not a valid function anymore?


          I could be wrong but I don't recall eval() being an EFS specific function hence I doubt it was in EFS Reference.
          It is available to EFS by virtue of being a Core Javascript function.
          Alex

          Comment


          • #6
            Hello Mihai,

            Alex is correct. eval() is part of core JavaScript 1.5. This link is part of Netscape's Core JavaScript 1.5 Reference guide.

            As for the crashes generated by your formula, your two lines of code look fine. My guess is that the crash is being caused by something else in your code. Especially if you are able to move those two lines somewhere else in the formula and they work. If you would post your formula here I will see if I can figure out what the problem might be.
            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
              Thank you Jason,

              I will post the efs file, if I figure out how to do it.
              Mihai
              Mihai Buta

              Comment


              • #8
                Hello Mihai,

                When you reply to a post through the forums, you can use the "Attach File" option.



                Or publish your EFS to a file share group and copy/paste a link to the file or file share group in your reply.
                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
                  Thx Jason, here it is.
                  See the function where eval() is.
                  Attached Files
                  Mihai Buta

                  Comment


                  • #10
                    Hello Mihai,

                    Can you also post your Functions.efs so I can have M1 and M2 set to their appropriate values? You could send a stripped down version of that with just the code related to the MultiplicatorsF function if you don't want to post the whole thing.

                    FYI, I haven't encountered any crashes yet. Please answer a few questions for me.

                    a. When do you encounter the crashes? Does the formula run properly at all for you before a crash occurs?

                    b. Are there any specific events that cause a crash with this formula, such as reloading the formula, changing symbols/intervals or anything like that?

                    c. What symbols, intervals and time templates do you typically experience the crash with?

                    d. What version of eSignal are you currently using?
                    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
                      Hi Jason,

                      1. Re: M1/M2 don't worry about them, just use any multiple of your chart time interval, because this is what they are.

                      2. What I posted works. To make it crash please replace the function PaintPlotF (in lines 122, 127, 132) with what the function does (which is "setBarFgColor(eval(CodeX)").

                      3. Yes, this is an old indicator that worked and works. I just wanted to improve performance because with several like it and several charts it is impossible to change symbols in real time.
                      NOTE: Important! "setBarFgColor(eval(CodeX)" works fine in an other indicator I have which displays MA's and Bollinger Bands.!?!?!?

                      4. The crash happens even when I check for syntax errors in EFS editor.

                      5. I am using build 608.

                      Thank you.
                      Mihai Buta

                      Comment


                      • #12
                        Hello Mihai,

                        I was able to reproduce the crash but I wasn't able to narrow down the exact cause. This one is very strange indeed. The logic of the formula doesn't look like a problem to me. I don't think the problem is related to eval() or setBarFgColor() either. I created several different test formulas using eval() and setBarFgColor() in a similar fashion without any problems. There is some complicated memory conflict being generated by your formula. It's beyond me. Since you have a working solution, just stick with your routine that's working. If you've submitted the crash reports, I'm sure our development team will look into the possible cause more closely.
                        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
                          LOL.
                          Thanks for trying Jason.

                          Related question: Is there anywhere a guide to what overhead is introduced by diferent calculations and/or settings and/or functions?

                          I noticed that a complicated efs, with 20-30 builtin studies that does not process the data executes significantly faster than any of my studies that have only a few studies, like the one you saw.

                          When I say slower, believe be much slower.
                          For example, try to plot 3-4 simple MA's, but paint the plots based on any criteria you want (say, slope/ROC(4)> or < 0).

                          The reason this is important is for using pages. If new pages do not come out quick, swapping pages makes no sense.

                          Second question: How do you delete a page, or a layout (without going to MyComputer....)?

                          Thanks.
                          Mihai Buta

                          Comment


                          • #14
                            I found the problem!

                            Was too obvious to see it!
                            Look @ input parameters list: line 2 (ShowM0, ...) is duplicated later!!!!!!!!!!!!!!

                            Mihai
                            Last edited by mbuta; 10-28-2003, 09:17 PM.
                            Mihai Buta

                            Comment


                            • #15
                              Hello Mihai,

                              Nice catch! I thought I was going crazy there for a minute.

                              As for tracking the overhead of a formula, all we have is the performance monitor (Tools --> EFS --> Performance Monitor). It will give you an idea of how efficient a formula is based on the number of calls and the amount of time each formula and various functions take to process. As you make changes to your code you can check these numbers to see if you've improved performance or not.

                              Here are a couple things you can do to help speed things up when switching between pages.

                              One way to force a formula to load more efficiently is to prevent any unnecessary code blocks from executing when the formula is loading. There may be many cases that aren't necessary to execute until the formula is loaded and running on the current bar. Unless it critical to the formula to do so of course. In this case, tell the formula to wait until it gets to bar -100 before doing anything. Try adding some of these conditions to your formulas.

                              PHP Code:
                              if (getCurrentBarIndex() != 0) return;

                              // or

                              if (getCurrentBarIndex() == 0) {
                                  
                              //execute code
                              }

                              // or
                              // This will allow the formula to only execute on the 
                              // most recent 100 bars
                              if (getCurrentBarIndex() < -100) return; 
                              You could also set up custom time templates to force the chart to load less data by default. If the chart has fewer bars to iterate the formulas through while loading, the faster the formula will load.

                              Another option for deleting layouts and pages is to just go to File --> Open in eSignal, right-click and delete.

                              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

                              Working...
                              X