Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

What's wrong with this "If" statement?

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

    What's wrong with this "If" statement?

    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    // Use this method for calculating your indicator values. Assign a value to each
    // plot below by replacing 'Close[0]' with your own formula.
    If ((EMA(Close,4)[0]) > (EMA(Close,9)[0]))
    Arrow0.Set(Close[0]);
    //SlowPlot.Set(EMA(Close, 18)[0]);
    }

    I get a CS1002 error among others. But click on the CS1002 button gets a "page not found" error in my browser.

    Thanks.

    #2
    Hello brooksrimes,

    Thank you for your post.

    You will need to use a lower case 'i' in your if statements. Corrected below:

    Code:
     
    protected override void OnBarUpdate()
    {
    // Use this method for calculating your indicator values. Assign a value to each
    // plot below by replacing 'Close[0]' with your own formula.
    if ((EMA(Close,4)[0]) > (EMA(Close,9)[0]))
    Arrow0.Set(Close[0]);
    //SlowPlot.Set(EMA(Close, 18)[0]);
    }
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks Ryan.

      That's going to be a hard habit to break, I normally do VB/VBA.

      I'm amazed the error message wasn't better, more specific.

      Brooks

      Comment


        #4
        Yes, can definitely be challenging when you're comfortable with one language and must adapt to the quirks of another.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          There seems to be a bug in NT7 when I click on the button for the error number, it opens a browser window and says "page not found".

          I wonder if that's on the fix list.

          Brooks

          Comment


            #6
            Hello Brooksrimes,

            The NinjaTrader 7 help guide is still a work in progress but not all error codes will produce a help guide article. Since you're working with C#, it could be a programming error that doesn't have a specific NinjaScript connection.

            You can see the error codes for version 7 that we have documented at the link below:
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              Hi Ryan,

              The error is CS1002 which was on the list you posted. There must be a little bug where NT7 is not bringing the webpage from within the script editor. I understand NT7 is in beta. Is there a procedure for reporting "anomalies"?

              Brooks

              Comment


                #8
                Yes, please use the Version 7 Beta General Questions & Bug Reports section of our forums for Version 7 issue reporting.
                Ryan M.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by inanazsocial, Today, 01:15 AM
                0 responses
                2 views
                0 likes
                Last Post inanazsocial  
                Started by trilliantrader, 04-18-2024, 08:16 AM
                5 responses
                22 views
                0 likes
                Last Post trilliantrader  
                Started by Davidtowleii, Today, 12:15 AM
                0 responses
                3 views
                0 likes
                Last Post Davidtowleii  
                Started by guillembm, Yesterday, 11:25 AM
                2 responses
                9 views
                0 likes
                Last Post guillembm  
                Started by junkone, 04-21-2024, 07:17 AM
                9 responses
                70 views
                0 likes
                Last Post jeronymite  
                Working...
                X