Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Statement Expected error messages

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

    Statement Expected error messages

    The following lines from a strategy, as well as many other lines display one of two errors: Statement Expected and ; Expected

    Please explain how I can correct. I don't understand Statement Expected and the lines calling for a semi-colon already have one.


    // Condition set 8 From Short to Exit Short
    if (Position.MarketPosition == MarketPosition.Short
    && CrossAbove(LinReg(
    15), (LinReg(2)-dBuff), 1))
    {
    ExitShort(
    "CS.LRC") ;
    }


    #region Properties
    [Description(
    "")] ;
    [Category(
    "Parameters")]
    publicint Length ;
    {
    get { return length; }
    set { length = Math.Max(1, value); }
    }
    [Description(
    "")]
    [Category(
    "Parameters")]
    publicint BSE
    {
    get { return bSE; }
    set { bSE = Math.Max(1, value); }
    }
    [Description(
    "")]
    [Category(
    "Parameters")]
    publicdouble BSEp
    {
    get { return bSEp; }
    set { bSEp = Math.Max(1, value); }
    }

    #2
    #region Properties
    [Description(
    "")] ;
    [Category(
    "Parameters")]
    publicint Length ;

    You do not need any ; in those lines. Please see the other properties for reference.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Sorry, don't understand.

      Why am I getting all these error messages about missing ; if they are not needed. Also, what does Statement Expected mean. Almost every part of the code is producing this error messge?







      Originally posted by NinjaTrader_Josh View Post
      #region Properties
      [Description(
      "")] ;
      [Category(
      "Parameters")]
      publicint Length ;

      You do not need any ; in those lines. Please see the other properties for reference.

      Comment


        #4
        skat100,

        Remove those semicolons. When you have improper code it messes up the whole evaluation for the rest of your code.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          what do i do to fix these errors?
          Attached Files

          Comment


            #6
            subterfuge,

            You need to use the correct syntax.

            PlaySound needs to have parenthesis brackets and the parameter of the sound file location needs to go inside that parenthesis. Then you would close the line with a single ; semicolon.

            Please see here for an example: http://www.ninjatrader-support.com/H...PlaySound.html
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              tried to copy the example but still got lots of errors?
              Attached Files

              Comment


                #8
                subterfuge,

                AND is not C# code. Every line is its own thing. You need to be doing it in a new line.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Wrong Address

                  I received this email addressed to "subterfuge".

                  My user name is skat100; my email address is "[email protected]".

                  Comment


                    #10
                    Not sure I follow skat100, perhaps you mean the note informing you of a thread reply? You'll get these for the threads you subscribed to or posted in...

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    648 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    369 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    108 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    572 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    574 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X