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 alexstox, 10-16-2018, 03:29 PM
                11 responses
                342 views
                0 likes
                Last Post aligator  
                Started by ageeholdings, 05-01-2024, 05:22 AM
                6 responses
                43 views
                0 likes
                Last Post ageeholdings  
                Started by tony_28217, Today, 07:04 PM
                0 responses
                11 views
                0 likes
                Last Post tony_28217  
                Started by flybuzz, Today, 10:33 AM
                1 response
                9 views
                0 likes
                Last Post flybuzz
                by flybuzz
                 
                Started by spencerp92, 10-10-2023, 09:56 AM
                4 responses
                310 views
                0 likes
                Last Post flybuzz
                by flybuzz
                 
                Working...
                X