Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trying to avoid NT8 crashes

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

    #16
    Hello manugarc,

    There has to be more to your issue than just creating vertical lines that is creating the OnRender() error.

    I have created a barebones strategy that only draws vertical lines and I am not receiving any errors. I have attached my code and a screenshot of a chart that demonstrates that the NinjaTrader 8 drawing objects do work properly.

    If you are completely stumped with debugging your code, we could get you connected with a NinjaScript Consultant that would be happy to debug the code for you. (If that is the case, please send an email to platformsupport[at]ninjatrader[dot]com.)

    Please let me know if I can be of further help.
    Attached Files
    JimNinjaTrader Customer Service

    Comment


      #17
      That's great Jim. Now put a number of those strategies to run and wait a few days. Exceptions don't appear as soon as you want.

      By the way, please don't offense, but I'm graduated as computer science engineer and I'm quite sure that if drawing a vertical line breaks NT8 the problem is not on my code. I have NEVER had this kind of problems on any other platform and I'm impressed you persevere on saying the problem is on my code when it's so obvious it's not possible since it happens when DRAWING A SAD VERTICAL LINE.

      EDIT:

      I'll elaborate it a bit more just to make the situation clear:

      If I'm using your "draw-line" function to ask NT8 to add a line, and I'm using your OnRender() function to draw them, there is no possible way that my code has nothing to do with those exceptions; all the process is "NT8-internal".

      Either your draw-line function stores in a wrong way the data, or OnRender() doesn't manage correctly the objects to be drawn, that's why I find misplaced that you ask me to contact any consultant.

      You have at least another person telling you he's having the same problem with horizontal lines; come on guys, someone should be checking what happens with OnRender() instead of trying to ignore the problem. It's not about any complex algorithm, it's about drawing a simple line...
      Last edited by manugarc; 04-22-2017, 10:04 AM.

      Comment


        #18
        Hello Jim,

        I am using the inbuilt NT Drawing Tools manually when this happens, so I am not using another indicator or strategy. The horizontal line freeze can occur at any time after the line has been drawn on the chart. Changing the colour of the arrow line makes the chart go black immediately, sometimes for 1 minute +.

        Comment


          #19
          Today I used the NT Drawing Tools to write some notes to the chart. I wanted to adjust them via the properties, and again the chart went black as I accessed properties. Once I got access, I adjusted the note and pressed OK. The chart went black again, lasting for several minutes, so I had to shut down NT via Task Manager.
          I have attached an image of the black chart.

          This general problem has been identified by others at Futures.io - see post #21 "Although NT8 is much faster in many regards, doing a few simple tasks, it is much more sluggish than NT7. The crosshair, bringing up indicators properties box and general graphical refreshing to name a few...*"
          Attached Files

          Comment


            #20
            Originally posted by manugarc View Post
            Hi Jim,

            I've simplified my strategies to the maximum; now they just draw some vertical lines (less than 10 per day in a 1 minute-bar chart each one), to be sure what's the problem, and after 20 hours of having them running here I have it:

            Code:
             2017-04-21 05:46:28:011|3|16|Failed to call OnRender() for chart object 'Vertical Line': 'External component has thrown an exception.'
            That's all the content on the log file, no more lines or messages.

            This makes NT8 (latest version) crash.

            I would appreciate a sincere answer; Is it possible to avoid these crashes as far as you know?
            Can I have an OnRender() code which Try/Catch on these exceptions?
            Do you think is there any way to keep on using NT8 without getting these exceptions?

            Thanks in advance.
            I have been having similar crashes when drawing vertical lines manually with the Draw Tools....(plus I get the same OnRender Vertical Line error message)....I draw perhaps 40 or so vertical lies a day....it is not unusual to get several crashes a day. So far cannot identify what may trigger a specific crash....

            Comment


              #21
              Hello everyone,

              I am not refuting anyone's claims that they are experiencing issues. In order to provide further input, I need to reproduce the issue. On my end, I cannot reproduce this matter. It will be much more beneficial if we can utilize a piece of code that demonstrates the issue on all of our machines.

              Those who are experiencing issues, can you reproduce issues with the barebones sample as well?

              Are there any exact steps I can take to reproduce this matter as well? For example, manugarc points out it needs to be tested for a few days, but is there a specific interval of market replay data we can use to efficiently reproduce the matter?

              @GerorgeW, are you able to reproduce crashes using Drawing Tools (on a chart not by NinjaScript) in Safe Mode? (Safe Mode will boot NinjaTrader 8 without any add-ons workspaces or templates.) Please Hold the Ctrl button and double click the NinjaTrader 8 icon. Release the Ctrl key when the splash screen appears and says you are booting Safe Mode. (You can confirm you are in Safe Mode under Help > About) If so, could you provide a video of the exact steps I need to take to reproduce? We use Jing. (I have not been able to reproduce by simply creating a text object and changing the properties.)

              If we cannot find a cause to this matter, we may have to arrange a remote support session to gather more information.

              I look forward to being of further help.
              JimNinjaTrader Customer Service

              Comment


                #22
                From that exception stacktrace it looks like you're trying to draw something to the chart from an async EventHandler. You need to wrap the draw request in a closure and Dispatch it to the correct thread's work queue:
                Code:
                	ChartControl.Dispatcher.Invoke(() => Draw.Line(this, false, 0, 1, 0 etc etc etc));

                Comment


                  #23
                  Hello Jim,

                  I removed all my indicators, reloaded them one at a time and tested the Drawing Tools. I have found that the issue only occurs when I have one of my custom indicators loaded. I'll have to check it out to discover why it is causing this problem. It only happens on tick charts that I have this indicator on. I have virtually the same indicator loaded onto minute charts (the only difference is that a secondary series on that indicator is set to Miniutes rather than Ticks), and the problem does not occur on the minute charts.

                  Thanks

                  Comment


                    #24
                    Hello everyone,

                    Thank you for providing that input.

                    I will continue monitoring this thread for any reproduce-able issues that we can pursue.

                    @manugarc, have you been able to reproduce the error using the sample provided?
                    Last edited by NinjaTrader_Jim; 04-26-2017, 07:55 AM.
                    JimNinjaTrader Customer Service

                    Comment


                      #25
                      Hello Jim,
                      I have worked out that my issue is that one of my indicators is using lots of draw objects, so if I load let's say 20 days, there are thousands of draw objects loaded. This causes the performance issues when I use the drawing tools and try to adjust the colour of say a manually drawn horizontal line. If I reduce the days loaded to say 5, as my indicator has less draw objects on the chart, the performance issue disappears when working with the drawing tools. But I am going to want many more than 5 days of tick data loaded at times.

                      My drawing code is all in OnBarUpdate(), I haven't got my head around OnRender() yet. I have tried the NT8 Best Practices - Performance Practices - Restricting OnRender() calculations to visible ChartBars : by wrapping the code below around my drawing objects code within the OnBarUpdate() section. This reduces the screen blackouts to seconds instead of minutes. Is there anything else I can do to eliminate them altogether?
                      Code:
                      if (ChartBars != null)
                      		  {
                      		    /* restricting this loop to only the ChartBars.From/ToIndex limits the loop to only what is visible on the chart. This reduces
                      			  the random spikes in CPU useage that drawing lots of objects that are not visible can cause*/
                      		    for (int barIndex = ChartBars.FromIndex; barIndex <= ChartBars.ToIndex; barIndex++)
                      }
                      }    {

                      Comment


                        #26
                        Hello GeorgeW,

                        I am glad you made progress with your issue.

                        If I follow correctly, the issue you are describing is that you have been able to optimize the performance of these drawing objects, but you are still bogged down when using over 20 days worth of drawing objects.

                        Since you have already optimized and noticed performance increases when restricting OnRender() calculations to ChartBars, and are still witnessing symptoms of excessive draw objects, I believe your only available option left is to add code to mark these drawing objects for garbage collection.

                        You can search for the string "Marking object references for garbage collection" in the Best Practices section of the help guide, where you found the ChartBars optimization.

                        This uses RemoveDrawObject() to remove drawing objects after a condition has been met. For example, if so may days have passed, remove these older draw objects.

                        RemoveDrawObject() - https://ninjatrader.com/support/help...drawobject.htm

                        Please let me know if I may be of further help.
                        JimNinjaTrader Customer Service

                        Comment


                          #27
                          Originally posted by GeorgeW View Post
                          My drawing code is all in OnBarUpdate(), I haven't got my head around OnRender() yet. ... Is there anything else I can do to eliminate them altogether?
                          I think performance will improve if, instead of drawing your objects in OnBarUpdate(), you'll draw them in OnRender(). The objects you draw in OnBarUpdate() are limited initially to the visible bars on the chart by your ChartBars for loop, but they persist invisibly as they scroll off the visible chart. Using that for loop condition in OnRender() will eliminate those "phantom" drawing objects that are unseen but not forgotten, since each render pass will draw only on the visible bars.

                          Comment


                            #28
                            Originally posted by tradesmart View Post
                            I think performance will improve if, instead of drawing your objects in OnBarUpdate(), you'll draw them in OnRender(). The objects you draw in OnBarUpdate() are limited initially to the visible bars on the chart by your ChartBars for loop, but they persist invisibly as they scroll off the visible chart. Using that for loop condition in OnRender() will eliminate those "phantom" drawing objects that are unseen but not forgotten, since each render pass will draw only on the visible bars.
                            Thanks for that, tradesmart. I'll have to try to get my head around Drawing objects in OnRender() over the next few weeks, something I'd been trying to avoid for a while.

                            Comment


                              #29
                              Originally posted by NinjaTrader_Jim View Post
                              Hello everyone,

                              Thank you for providing that input.

                              I will continue monitoring this thread for any reproduce-able issues that we can pursue.

                              @manugarc, have you been able to reproduce the error using the sample provided?
                              Hi Jim,

                              Please excuse me for the delay on answering; I didn't notice so many new messages on the thread and thought it was ended. I'm glad you keep on searching for the solution.

                              I have not used your code but mine modified multiple times and several days, because I have no doubt the problem is on NT side, not in my code. I've tried to draw less vertical lines, but this is nonsense; please have in mind that we are talking (in my particular case) about drawing less than 20 lines per day, running about 6 strategies together in a same machine, that makes a maximum of 120 lines a day on a machine with 16GB of RAM, and that makes a nowadays software crash? Just think in how many bars are drawn in that same time (24h x 60 min x 6 strategies = 8640 bars (just in 1 day!)); Do you really think that 100 extra objects can produce a memory problem? It's absolutely impossible.

                              That's nonsense; the problem cannot be the number of lines drawn, there has to be a problem of another kind; either there is a race-condition problem, or some reference to an object is lost at some moment, or some kind of problem regarding to multi-threading (as I pointed on previous posts, though I don't really think this is the case, that's another problem).

                              As I told you, I have many years of experience developing software, so I have no problem in trying to help to solve this, but I can't be trying sample codes for days and having my machines busy with that, when I know that the problem cannot be the number of lines.

                              As I also told you, if you want to provide me your OnRender() code to try to catch the exception and detect the problem, I'll be glad to help.

                              Comment


                                #30
                                Video reviews of problem....

                                As mentioned earlier....I have been having similar crashes when drawing vertical lines manually with the Draw Tools....(plus I get the same OnRender Vertical Line error message at a crash)....I draw perhaps 40 or so vertical lines a day....it is not unusual to get several crashes a day with this method. So far cannot identify what may trigger a specific crash....

                                Here are several videos below on the problem....have discovered a way to draw the vertical lines, apparently without a crash...the first video explains the new technique...
                                Plus looking at the resize pointer in the 2nd video....could this possibly be part of the problem...??

                                Have been working with Ninja support about this problem...but so far no resolution....

                                Thanks....

                                Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.


                                Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by ScottWalsh, Today, 04:52 PM
                                0 responses
                                1 view
                                0 likes
                                Last Post ScottWalsh  
                                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  
                                Working...
                                X