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 CarlTrading, 03-31-2026, 09:41 PM
            1 response
            43 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            20 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            30 views
            1 like
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            48 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            38 views
            0 likes
            Last Post CarlTrading  
            Working...
            X