Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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...
                    BertrandNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by cupir2, Today, 07:44 PM
                    0 responses
                    4 views
                    0 likes
                    Last Post cupir2
                    by cupir2
                     
                    Started by reynoldsn, Today, 07:23 AM
                    6 responses
                    19 views
                    1 like
                    Last Post reynoldsn  
                    Started by reynoldsn, Today, 07:26 PM
                    0 responses
                    4 views
                    0 likes
                    Last Post reynoldsn  
                    Started by ETFVoyageur, 05-07-2024, 07:05 PM
                    12 responses
                    79 views
                    0 likes
                    Last Post bltdavid  
                    Started by Haiasi, 04-25-2024, 06:53 PM
                    5 responses
                    76 views
                    0 likes
                    Last Post alancurry  
                    Working...
                    X