Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

error in code

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

    error in code

    Why doesn't this line compile?

    int xyz = Math.Sign(BOP(bopDaysLong)[0]);

    Thx

    #2
    The error messages at the bottom of the editor window will provide you an idea what's wrong with your code.

    Comment


      #3
      It compiles for me.

      are you sure bopDaysLong is defined? What does the compile error say?

      I would replace bopDaysLong with a static value like 5 just to test

      mrLogik
      mrlogik
      NinjaTrader Ecosystem Vendor - Purelogik Trading

      Comment


        #4
        Ok guys, that compiles. By chance i have removed the part of the line that gave the problem

        It's
        Code:
        private int xyz = Math.Sign(BOP(bopDaysLong)[0]);
        that gives a lot of errors.
        Why can't i define a local variable inside OnBarUpdate() ??

        Comment


          #5
          You can't declare a private within a private method (OnBarUpdate).

          Just remove the private part of that line, there is no need for it as all variables declared within OnBarUpdate are inherently private.
          mrlogik
          NinjaTrader Ecosystem Vendor - Purelogik Trading

          Comment


            #6
            Hello,

            Thank you for your post mrlogik!
            DenNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            579 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            334 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            554 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            551 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X