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

Problem when set the indicator using the path drawing tool to global drawing object

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

    Problem when set the indicator using the path drawing tool to global drawing object


    Hello, I am having a problem when I set my indicator to use the path tool to show global drawing object, the following error message appears:

    "Unhandled exception: Collection was modified; enumeration operation may not execute."

    and this another error:

    "Unable to create instance of NinjaScript 'Path'. Most likely either the implementation no longer exists, there is no default constructor defined, the default constructor does not work correctly, or the 'OnStateChange' implementation for State=SetDefaults is flawed: System.InvalidOperationException: Collection was modified; enumeration operation may not execute. at System.ThrowHelper.ThrowInvalidOperationException( ExceptionResource resource) at System.Collections.Generic.List`1.Enumerator.MoveN extRare() at NinjaTrader.NinjaScript.DrawingTools.PathToolSegme ntContainer.CopyTo(NinjaScript ninjaScript) at NinjaTrader.NinjaScript.DrawingTools.PathTool.Copy To(NinjaScript ninjascript) at NinjaTrader.NinjaScript.DrawingTools.DrawingTool.C lone()"

    And from there the global lines stop working, I need to close and open Ninjatrader again to get them working again.

    #2
    Hello tff2011,

    Thank you for the post.

    I would be happy to look into this however I would need more specific details about the situation along with a sample of the code you had used. Could you attach a small sample that reproduces the error and provide the steps to see that?

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      I've attached a code sample that reproduces the bug. After it creates a couple paths, it throws the error I've mentioned and global drawing tools stop working altogether inside NinjaTrader. If isGlobal is set to false, the code works flawlessly.

      Originally posted by NinjaTrader_Jesse View Post
      Hello tff2011,

      Thank you for the post.

      I would be happy to look into this however I would need more specific details about the situation along with a sample of the code you had used. Could you attach a small sample that reproduces the error and provide the steps to see that?

      I look forward to being of further assistance.
      Attached Files

      Comment


        #4
        Hello tff2011,

        I have attempted to reproduce with the test script, and I have not hit the issue.

        I have included the steps I have performed. Could you elaborate on how we can reproduce the issue with the test script?

        I have done the following while connected to the Simulated Data Feed:

        1. Open CL 05-20 5 second chart with 50 Bars To Load. Trading Hours template set to Default 24/7
        2. Right click on Chart tab and Duplicate in new window
        3. Apply Horizontal Line in first chart and attach it to All Charts (See global Drawing object appear in second chart)
        4. Apply indicator to first chart. (See globally drawn path on both charts.)

        Could you clarify on the steps needed to reproduce?

        We look forward to assisting.
        JimNinjaTrader Customer Service

        Comment


          #5
          Hi Jim,

          Do the following steps.

          1. Connect Coinbase
          2. On 5 seconds chart, open BTCUSD Candlestick chart
          3. Insert the GlobalBug indicator attached in the previous post
          4. The print error below should appear immediately after confirming the insertion of the indicator in the graph.
          Attached Files

          Comment


            #6
            I can confirm this bug happens.

            Comment


              #7
              Originally posted by tff2011 View Post
              Hi Jim,

              Do the following steps.

              1. Connect Coinbase
              2. On 5 seconds chart, open BTCUSD Candlestick chart
              3. Insert the GlobalBug indicator attached in the previous post
              4. The print error below should appear immediately after confirming the insertion of the indicator in the graph.
              Could you reproduce this error?

              Comment


                #8
                Hello tff2011,

                Thank you for providing the sample.

                I was able to see the error with your added steps, I will review this further and report this to development. If I have any other details that I can provide I will post them here.


                I look forward to being of further assistance.
                JesseNinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by NinjaTrader_Jesse View Post
                  Hello tff2011,

                  Thank you for providing the sample.

                  I was able to see the error with your added steps, I will review this further and report this to development. If I have any other details that I can provide I will post them here.


                  I look forward to being of further assistance.

                  Hi Jesse,

                  Any solution about this error?

                  Comment


                    #10
                    Hello tff2011,

                    Not currently, if I have any updates that I can provide I will reply back here when I have that information.

                    Please let me know if I may be of additional assistance.
                    JesseNinjaTrader Customer Service

                    Comment


                      #11
                      If it's of any use for the development team, I was able to fix this on my end by duplicating the current Path Tool code and removing everything related to PathToolSegments on it, so I believe the error is related to that part of the code. Since for my use case I didn't need alert support, this worked well enough for me.

                      As of note, I only tried removing the PathToolSegments code because they were causing a memory leak, NinjaTrader was consuming several gigabytes of memory after updating them for a few hours. The development team should probably look into that.

                      I've experienced lots of bugs related to global drawing tools with indicators, I believe they deserve more attention in the next releases.

                      Comment


                        #12
                        Hi, I’m having the same issue where using Draw.Path in my strategy is resulting in the error: "Unhandled exception: Collection was modified; enumeration operation may not execute."

                        Has there been any progress on resolving this issue? If not, is there any short term work around?

                        I’d love to use Plots, but I need to be able to see the resulting plot/path on multiple charts & timeframes, which is why I’ve resorted to global paths. I don’t suppose there’s a way to make plots global?

                        Thanks, I’d really appreciate any help you can offer.

                        Comment


                          #13
                          Hello mps227,

                          It looks like this is an old post which has not had a specific resolution. If you are seeing that some specific code being used is having the same error in the current version could you please make a test script that produces the error at attach it with the steps to see the error? I tried the previous script that was posted but currently am unable to reproduce the error on my end.

                          I look forward to being of further assistance.
                          JesseNinjaTrader Customer Service

                          Comment


                            #14
                            Hi Jesse, sure, thanks for the help.

                            I've attached a version of my strategy script which has excised the logic not relevant to the issue. The script creates a high and low price channel (3 day high, 8 down low) by saving the high/low prices, creating/adding chart anchors, and drawing them with the path tool.
                            1. Run strategy as is on a daily chart (I've been using the NQ, and I also keep a 1 minute NQ chart up to the side)
                            2. After loading, you should see unhandled exceptions, you should see that the price channel path drawings stop prematurely on the chart, and you should notice the global time scroll/databox stops responding to the chart
                            3. If you disable the strategy, then re-enable, you should notice the same prior issues, but the path drawings should appear
                            I've also attached some reference screenshots showing the error.

                            Appreciate the assistance, I really need the ability to see global drawings.
                            Attached Files

                            Comment


                              #15
                              Hello mps227,

                              Thank you for the reply.

                              I don't see that you attached a .cs file, could you please re post the file?

                              Also it sounds like you have some logic to draw the orders, is that absolutely necessary to see the problem or can you simply draw an object as the only code using the values that your logic would have made? If you can make a stripped down sample that does not have any extra conditions/variables that would be helpful in forwarding the problem to development.

                              I look forward to being of further assistance.
                              JesseNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by ScottWalsh, Today, 04:29 PM
                              0 responses
                              5 views
                              0 likes
                              Last Post ScottWalsh  
                              Started by rtwave, 04-12-2024, 09:30 AM
                              2 responses
                              22 views
                              0 likes
                              Last Post rtwave
                              by rtwave
                               
                              Started by tsantospinto, 04-12-2024, 07:04 PM
                              5 responses
                              70 views
                              0 likes
                              Last Post tsantospinto  
                              Started by cre8able, Today, 03:20 PM
                              0 responses
                              7 views
                              0 likes
                              Last Post cre8able  
                              Started by Fran888, 02-16-2024, 10:48 AM
                              3 responses
                              49 views
                              0 likes
                              Last Post Sam2515
                              by Sam2515
                               
                              Working...
                              X