Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

why am i seeing this and how do i fix it?

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

    why am i seeing this and how do i fix it?

    I am trying to the Bars.BarsSinceSession function. I have used this before and it has worked flawlessly but now I am seeing this in the log and it won't compile.

    **NT** Error on getting/setting property 'Bars' for strategy 'reversal/84a7c06a5975436e9a85dc3524df569f': Item has already been added. Key in dictionary: 'Int32 Bars' Key being added: 'Int32 Bars'

    how do I fix this I have upgraded to the latest version with no luck.

    thanks

    #2
    Hello Ragdoll,

    Thank you for your note.

    Can you get me the most simplest form of code that reproduces this error for you?
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      The simplest version I am using is:

      if (High[1] == HighestBar(High, Bars.BarsSinceSession - 1))
      {
      do something clever
      }

      I have also tried saving as a different name and it follows to the new name.

      I also eliminated the call altogether and I still get the message when I try to enable the strategy
      Last edited by Ragdoll; 02-04-2014, 04:39 PM.

      Comment


        #4
        Originally posted by Ragdoll View Post
        The simplest version I am using is:

        if (High[1] == HighestBar(High, Bars.BarsSinceSession - 1))
        {
        do something clever
        }

        I have also tried saving as a different name and it follows to the new name.

        I also eliminated the call altogether and I still get the message when I try to enable the strategy
        Hi Ragdoll,

        I believe that HighestBar returns an Int representing some number of bars ago. In your "if" statement, you're comparing a price (High[1] which is a double value) to an integer value. Not sure if that's the extent of the problem, but it seems likely you're not comparing two items which make sense to compare.

        Comment


          #5
          good point

          that should read High[HighestBar(High, Bars.BarsSinceSession)]
          Last edited by Ragdoll; 02-04-2014, 05:39 PM.

          Comment


            #6
            I am still having this problem

            Comment


              #7
              Ragdoll,

              Please provide the script that you are using so I can test this on my end.
              Cal H.NinjaTrader Customer Service

              Comment


                #8
                here it is .

                it wont compile because it says no definition of type BarsSinceSession for int
                Attached Files

                Comment


                  #9
                  Hello Ragdoll,

                  Can you send me a request at support[at]ninjatrader[dot]com with Attn Cal in the subject and a reference to this thread in the body.

                  I want to go ahead and setup a remote support session
                  Cal H.NinjaTrader Customer Service

                  Comment


                    #10
                    sent

                    Please note:
                    I have ALS and I am totally paralyzed(hence the name Ragdoll)
                    I use an eye gaze device to type so interactive sessions can be slow.

                    Comment


                      #11
                      Resolved!

                      Moral of the story:
                      Don't name variables using same name as reserved words. I had a variable named Bars for future use defined. DOH!!

                      Thanks Cal

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                      0 responses
                      627 views
                      0 likes
                      Last Post Geovanny Suaza  
                      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                      0 responses
                      359 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by Mindset, 02-09-2026, 11:44 AM
                      0 responses
                      105 views
                      0 likes
                      Last Post Mindset
                      by Mindset
                       
                      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                      0 responses
                      562 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by RFrosty, 01-28-2026, 06:49 PM
                      0 responses
                      568 views
                      1 like
                      Last Post RFrosty
                      by RFrosty
                       
                      Working...
                      X