Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Syntax Problems

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

    #31
    Please advise whether you received attached complete code as zip file.
    Thanks.

    Comment


      #32
      skat100,

      It appears I did not receive the file. Please send it to my direct email please: josh [dot] peng [at] ninjatrader [dot] com. Also please make a note that it is for this forum thread. Thank you.
      Josh P.NinjaTrader Customer Service

      Comment


        #33
        If I unlock the code can I make changes (edit} directly to the code?

        Comment


          #34
          Yes, only after you unlock the code can you make any manual edits. If this was coming from a strategy built by the Wizard you likely have something corrupted in your NinjaTrader and would need a fresh reinstall.

          1. Backup all of your files: NinjaScript, workspaces, etc.
          2. Uninstall NT
          3. Delete My Documents\NinjaTrader 6.5 (YOU WILL LOSE EVERYTHING)
          4. Clear internet browser cache
          5. Reinstall NT
          6. What is corrupt is likely one of your NinjaScripts so do not reintroduce those until you can establish a base line working scenario with what you are trying to do. Slowly reintroduce your NinjaScripts afterwards till you find one that is breaking it. If you do not find any, that is great.
          Josh P.NinjaTrader Customer Service

          Comment


            #35
            Since last post, I believe I have corrected all errors except one new one:
            "Your strategy likely holds one or more recursive properties which could cause Ninja Trader to crash: BufferLong BufferShort. Do you want to edit these properties?"

            Can you tell me how to correct?

            Also, what is the best way to send you my code? It seems to be too long for sending through the forum. Should I send an email with an attachment or what way would you suggest?

            Stan Katz
            [email protected]

            Comment


              #36
              skat100,

              I do not know what you are doing without your code. Just attach it here on the forums as an attachment.
              Josh P.NinjaTrader Customer Service

              Comment


                #37
                Sorry to be so dumb, Josh, but I ddon't see a way to make an attachment to this reply.

                Comment


                  #38
                  When you post under the main body part there is a section called "Additional Options". There is a button called "Manage Attachments" from there.

                  Your code most likely is due to an error in your Properties region in terms of capitalization of your variables. Please ensure you adhere to the capitalization requirements.

                  Code:
                  [Description("Period for fast MA")]
                  [Category("Parameters")]
                  public int [B][COLOR=Red]F[/COLOR][/B]ast
                  {
                      get { return [COLOR=Red][B]f[/B][/COLOR]ast; }
                      set { [COLOR=Red][B]f[/B][/COLOR]ast = Math.Max(1, value); }
                  }
                  The "private int fast = 20;" in the Variables region of your code needs to be lower cased too.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #39
                    Thanks, Josh, hope this works: LinRegCrossovers Strategy attached.

                    Stan Katz
                    [email protected]
                    Attached Files

                    Comment


                      #40
                      skat100,

                      You still have not fixed the problem we discussed earlier. Close is a reserved word. You cannot use it as an input parameter.

                      Please address the BufferLong and BufferShort as I discussed in my earlier post too. You need to be mindful of capitalization. The public variable is capitalized and the private one needs to be lower case.
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #41
                        These lines:
                        if (Position.MarketPosition == MarketPosition.Short
                        && BarsSinceEntry() >= BSE
                        && Position.GetProfitLoss(Close[0], (PerformanceUnit.Currency) < BSEp)) ;

                        You cannot use ; right after an if-statement. There are several occurrences of this. Please go through and fix that too.
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #42
                          Syntax Errors

                          Thanks, Josh. I fixed those wrong ; I'm surprised the compiler did not catch them?.

                          Did you see the error message about the properties (paramters) listings being considered to be duplicates of the variables declarations? Should I delete either the properties listing or the variables listing? I did not make these duplications; perhaps they were made by the Wizard?

                          Comment


                            #43
                            Stan,

                            I already responded to your email you sent in to support. Please keep all communication about this case on the forums here. It makes it extremely difficult to offer you quality support when we have to track your responses across different mediums. Thank you.

                            Your code is in a very jumbled mess right now. Whenever you make a change or get a new error I will need to see the latest rendition of your code or else I cannot advise you on what to do.
                            Josh P.NinjaTrader Customer Service

                            Comment


                              #44
                              Syntax Errors

                              Sorry about all this, Josh. Attached is latest code. I hope it's in better shape than when you last looked at it.
                              Attached Files

                              Comment


                                #45
                                Condition set 4 and 6 still have the ; issue I mentioned earlier for the if-statements.

                                You changed your Properties region improperly. Please take a note of which ones are capitalized and which ones are not in my prior post. You are also still using Close. You cannot use this word to create a parameter. It is reserved.

                                Please open up SampleMACrossOver and take a look at how they create parameters. You need to maintain the exact structure. Everything needs to be done exactly the way you see it there. Open up the Variables region and the Properties region. Be extremely mindful of which is public and which is private as well as with which are capitalized and which are not.
                                Josh P.NinjaTrader Customer Service

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                                0 responses
                                597 views
                                0 likes
                                Last Post Geovanny Suaza  
                                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                                0 responses
                                343 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by Mindset, 02-09-2026, 11:44 AM
                                0 responses
                                103 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                                0 responses
                                556 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by RFrosty, 01-28-2026, 06:49 PM
                                0 responses
                                555 views
                                1 like
                                Last Post RFrosty
                                by RFrosty
                                 
                                Working...
                                X