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

NT Is Passing A DISPOSED Bars Array Into Plot()!

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

    NT Is Passing A DISPOSED Bars Array Into Plot()!

    Yikes!

    A test case is attached: I have gotten 5% false positive results: some magic APPEARED to happen when I commented some of the lines out of Initialize (such as COBC); but in any case, the following output is from my console (it has happened both on a live connection and on the Replay):

    lastBackFillBar=290015
    Finish BackFill[1] Volume = 6258
    Plot(): CurrentBar=290015 BarsInProgress=1 BarsArray[1].Disposed=True backFill=False

    ALSO: this ONLY has happened for me on non-minute bar types: the above was printed from a Point And Figure [1, 1, 3] on 6E 06-14 (the primary series). On a 5 minute chart w/ the same instrument, the error has NEVER appeared.

    FURTHER: I was tipped by the debugger catching an early index range exception (below): this paring-out of my code is intended to back-fill the chart using the series added in Init: once backfill is complete, the series is disposed. On the minute charts, NT will iterate BarUpdate for every 'historical' bar in BOTH series' before passing anything to Plot. However, on the non-minute types (it also happens on volume, range, etc) NT actually will pass the last 1-2 'historical' bars of the added series to Plot (and I was not checking BarsInProgress since I dispose of the series) and my code would try accessing ChartControl.GetYByValue assuming this was a non-historical bar (and I also assumed series 0, but that in fact wouldn't matter: it's the fact then the series is actually disposed, and on this exact method the index exception would rise) -- the line raising this exception is present in the test case, and you should be able to trap that.

    The above exception:

    A first chance exception of type 'System.IndexOutOfRangeException' occurred in NinjaTrader.Core.dll
    An exception of type 'System.IndexOutOfRangeException' occurred in NinjaTrader.Core.dll but was not handled in user code
    Additional information: Index was outside the bounds of the array.

    2014-05-18 19:33:00:627 ERROR: Error on plotting indicator 'MarketDataTest'. Please check the 'OnBarUpdate' or the 'Plot' method: Index was outside the bounds of the array.
    Attached Files

    #2
    Hello steevcoco,

    Thank you for your post.

    Is this the full .cs file you are using? It is missing the "#region NinjaScript generated code. Neither change nor remove." region that is necessary for the indicator to run properly.

    Comment


      #3
      PatrickH:

      ... The code was lost during a debug session when I did some copy/paste. It took a while for me to notice; and I'm seeing that also NT does not re-generate the code when I compile ... I thought perhaps that was because the code was inserted elsewhere ...

      I just now ran the New Indicator Wizard and re-entered the code in a new Indi ... but the same condition appears. The new code is attached.

      There IS ALSO ANOTHER strange condition I just recently discovered; and was going to post about -- it happens for this brand-new Indi, as well as the one I'm developing:

      When closing the properties dialog for the Indi, after clicking "OK", the dialog populates with a Plot called "Dummy". This does not appear in the Indi when plotted, but it actually then lives in the properties dialog! It took a while for me to notice since my code currently has no properties in the dialog; but I've just started to expose them ... and so I just noticed that. It is also appearing in this brand-new wizard-generated Indi that's attached. Can you help with that too?
      Attached Files

      Comment


        #4
        Hello steevcoco,

        Thanks for reporting this. This is outside of our Supported code especially disposing of a BarsArray object but I can see what you are trying to go for here.

        I will report this to our development team to look into this further.

        Happy to be of further assistance.
        JCNinjaTrader Customer Service

        Comment


          #5
          "Dummy" Plot

          OK JC: thanks for that.

          Can you tell me anything about the "Dummy" plot? -- It is still showing in my indi. Attached is a screen capture of the properties dialog of the Indi I attached in my prior post (with no code changes -- that was a wizard-generated Indi) ... There is a Plot property called "Dummy" ...Obviously, not in the code.
          Attached Files

          Comment


            #6
            Hello steevcoco,

            Yes, is is the initial setting for a Plot inside of the Core NinjaTrader Engine. Since you are not adding a Plot inside of your indicator but you are setting "PlotsConfigurable = true;" inside of NinjaTrader, when you apply the Indicator to the Chart NinjaTrader will use the initial settings for this.

            Since you are not adding a Plot you may want to remove that "PlotsConfigurable".

            Happy to be of further assistance.
            JCNinjaTrader Customer Service

            Comment


              #7
              Thanks JC!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by DJ888, 04-16-2024, 06:09 PM
              4 responses
              12 views
              0 likes
              Last Post DJ888
              by DJ888
               
              Started by terofs, Today, 04:18 PM
              0 responses
              8 views
              0 likes
              Last Post terofs
              by terofs
               
              Started by nandhumca, Today, 03:41 PM
              0 responses
              6 views
              0 likes
              Last Post nandhumca  
              Started by The_Sec, Today, 03:37 PM
              0 responses
              3 views
              0 likes
              Last Post The_Sec
              by The_Sec
               
              Started by GwFutures1988, Today, 02:48 PM
              1 response
              9 views
              0 likes
              Last Post NinjaTrader_Clayton  
              Working...
              X