Announcement

Collapse
No announcement yet.

Syntax Error Help!!

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

  • Syntax Error Help!!

    I keep getting a syntax error, "line x, vBB has no properties". I'm trying to modify a study I've been using and can't figure out what it's looking for. My guess is it's very basic but I'm a noobie to efs.
    Have searched glossary and efs indicator guides and "properties" are mentioned but not described.

    I'd really appreciate anyone providing some direction on this. Thanks.

    Steve

  • #2
    Hello Steve,

    Typically this means that you are trying to access the properties of an object that has not been properly initialized yet. Usually the solution is to perform a null check for that variable imediately after the line of code that attempts to initialize its value. Go to that line of code and add the following as the next line of code.

    if (vBB == null) return;

    This will prevent the rest of the fomula from processing until vBB is established with valid data.
    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
      Hi Jason, thanks for the tip on my study but I couldn't get it to work. I know exactly what I want it to do but I've been unable to make the necessary modifications as per instructions from Alex who wrote the study and has spent a lot of time tutoring me, but I'm just not getting it. I'm a good trader but a lousy programmer and I need to get this completed. Everything in the study functions okay but I want to add the following pre-alert criteria:

      1. if((vBB.getValue(BollingerStudy.UPPER,-3)-vBB.getValue(BollingerStudy.BASIS,-3))>0.05 && //3 bars ago the UpperBB - BasisBB was greater than 0.05

      2. close(-1) > open(-1) && //prior close greater than open

      3. close(0) > open(-1) && //current close greater than open

      I really think it's something quite simple so perhaps you could help and give it a shot. I've attached the study.

      Thank you very much, Steve
      Attached Files

      Comment


      • #4
        Hello smart1,

        The order of process is the cause of your problem with this formula. In main, you put the if (vBB == null) return; in the wrong place. It should be right after where you initialize the vBB object on line 85. You are checking to see if vBB is null on line 65, which it will be at that point, which then exits main with the return statement that follows. So the rest of your code in main is not executing and vBB never gets initialized on line 85.

        Move line 65 to line 86 and then move lines 85 and 86 to the top of main(). This will allow your variables on lines 59-64 to get properly established so you can use them in your conditional statements at the end of main. That should get you going.
        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
          Hi Jason, just about got it but need a few tweaks. On line 52 I added your suggestion but had to keep line 51 so the BB conditions would function. I only kept desired variables in lines 53-56 and deleted others.

          Seems to be a problem between 90-93: if I use 90-91 and delete 92-93 or vice versa, it performs properly. When I activate all 4 conditions in 90-93 it doesn't function correctly.

          I'm not sure if it's condition positioning, variables, etc, or if it's just this noobie user. Could you plz take a look and let me know. Lines 89-93 shows what I'm trying to do:
          *prior UpperBB-prior BasisBB<=.05 and
          *prior high>=prior UpperBB and
          *prior close>prior open and
          *current high>=current UpperBB and
          *current close>current open and
          alerts

          Thanks Jason.

          Steve
          Attached Files

          Comment


          • #6
            Hello Steve,

            Your formula is working, its just that all the conditions together are very restrictive. You may have to allow a significant amount of time to pass before you receive an alert in real time. Another good way to verify that a set of conditions is evaluating to true is to add a debugPrintln(getCurrentBarIndex()) statement along with your Alert calls. You should see some historical bar index number print to the formula output window when you reload the formula. Another thing you can do is add setBarBgColor(Color.grey); to the same code block. This will highlight the historical bars that met all your conditions when you reload the formula. I didn't see many, but there are some.
            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
              Jason, I agree this should be bug tested but getting syntax error on debugPrintIn(getCurrentBarIndex()). Do I also need to add if(getCurrent BarIndex) since it's not on the study, and what should I put in the ()? You raised the question of too many conditioins for my S15 intervals. Could any of the following also present a problem:
              *leap & stack memory allocation settings
              *my hardware--I'm a power user so this could be an issue. I have a new comp with 50gb free, AMD Athlon 2800, XPHome, IE6.0, Wireless HiSpeed @3300kbps, (2) 21"CRT monitors.

              What's puzzling to me is that the first 3 conditions are fine on lines 89-91 but 92-93 don't work at all. Maybe after I setup the debugging and hilight historical bars I'll get an answer.

              Thanks again for all your help and hope ya have a great weekend.


              Steve

              Comment


              • #8
                You mentioned "debugPrintIn"... the actual function is debugPrintln (note the lower case "L" before the "n".) The lower case is often mistaken for an upper case "I", so it's a common mistake.
                Regards,
                Jay F.
                Product Manager
                _____________________________________
                Have a suggestion to improve our products?
                Click Support --> Request a Feature in eSignal 11

                Comment


                • #9
                  Hi Jay, thanks for clarifying debugPrintl1. However, I'm not certain this is what I need to do at this time. Plz see Jason K. thread posted 11/4....he suggests that perhaps there are too many conditions (I use 15S intervals). I've attached my study and here's the problem: lines 92-93 don't function at all. When I deleted 90-91, 92-93 still didn't fuction. Accordingly, I do not think 92-93 is coded properly or perhaps may be in the wrong sequence. All I'm trying to do is have 2 consecutive GREEN bars
                  (bar's close higher than bar's open) hit the upperBB.

                  Could you plz give me your ideas on this? I really appreciate your help, thanks.

                  Steve
                  Attached Files

                  Comment


                  • #10
                    var vBB = null;

                    in line 8 needs to be set to deinfe the BB you are looking to compare in lines 92/93.

                    Comment


                    • #11
                      Hi David, thanks for your reply. I'd like to resend you the correct study which reads a little differently:
                      In this study lines 91-92 are bar/BB conditions and work fine. The problem is that it can't distinguish between green/red bars and I only want alerts triggered if they are green, i.e. the bars hitting the UpperBB in 91-92 are green only (bar's close is higher than it's open). So I've tried to add lines 93-94 which don't function at all even if I delete 91-92. Simply put in Noobie language:

                      *UpperBB - BasisBB <=.05, AND
                      *prior high equal/greater than prior UpperBB, AND
                      *current high equal/greater than current UpperBB, AND
                      *both of these highs are green bars, AND
                      ******ALERTS.

                      Do I still need to define the "green" bars in 93-94 as per your suggestion of vBB = null in line 8, or do I need to do something different?

                      I'd really appreciate your ideas, thanks.

                      Steve
                      Attached Files

                      Comment


                      • #12
                        I added

                        vFlag1 == 0) { //flag is equal to 0
                        debugPrintln("Hit");

                        and got two hits, so the alert is firing on the ab z4 chart I used. Where I have no idea, but it looks like it is working.

                        The alerts will not fire except during the day when trading is active, ie not after hours like now

                        Line 8 is not an issue as I look a little closer.

                        Comment


                        • #13
                          David, thanks for the quick response. To test the condition alerts I'll add debugPrintln("Hit"). I believe that 93-94 are not firing at all and any alerts you saw were probably from 91-92. So I'll deactivate lines 91-92 which are the prior/current "highs" which I know are working. This way I can see if lines 93-94 are firing by themselves -- these represent the prior/current bar's close higher than open (green bars).

                          If I test this per the above conditions and I don't get alerts does this mean 93-94 need to be coded differently? Again, I already know that 91-92 works okay.

                          I feel like a pest but I've worked on this formula with several very good people for over a month and this is the final touch. I'm convinced this can do what I want so plz hang in there with me a little longer. I'll test this tomorrow and let you know.

                          Thanks again,

                          Steve

                          Comment


                          • #14
                            If you do the recoding and don't get any hits, it could be your IF conditions are too restrictive (or coded wrong of course)

                            To me they look very restrictive, but I was looking at 1 min time frame.

                            Comment


                            • #15
                              Hi David, I tested my study for alerts separately and together and found that you were correct:
                              1. 2 consecutive highs hitting Upper BB (90-91 only) -- okay.
                              2. 2 consecutive green bars (92-93 only) -- okay.
                              3. Combined (90-93) -- no alerts at all.

                              Does this give you any clue as to what the problem might be? You mentioned the conditions might be too "restrictive" which Jason K. also suggested. If this is the problem how do I resolve it? I'm using 15S intervals.

                              I also ran debugPrintln("Hit") on line 95 but don't know what this does. Is it supposed to show actual "true" results somewhere?

                              Plz let me know what you think. Thanks again,

                              Steve

                              Comment

                              Working...
                              X