Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 manueldecastro, Yesterday, 10:26 AM
                      4 responses
                      20 views
                      0 likes
                      Last Post manueldecastro  
                      Started by TraderIqbal, 10-20-2023, 10:12 AM
                      2 responses
                      119 views
                      0 likes
                      Last Post Funnywo
                      by Funnywo
                       
                      Started by Creamers, 04-27-2024, 05:32 AM
                      12 responses
                      72 views
                      0 likes
                      Last Post Creamers  
                      Started by fredericlebre, Today, 01:19 AM
                      0 responses
                      10 views
                      0 likes
                      Last Post fredericlebre  
                      Started by TraderJA, Today, 12:06 AM
                      0 responses
                      12 views
                      0 likes
                      Last Post TraderJA  
                      Working...
                      X