Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

null chartControl crashes strategy analyzer

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

    null chartControl crashes strategy analyzer

    Ok, so here's a common scenario. You create an indicator that does some drawing.
    You then create a strategy to exercise it.
    Unfortunately, this isn't going to work. There is a bug in @Shapes.cs (and I suspect in similar circumstances in many other NT files). I've uploaded the simplest of examples to show you where the problem is. Basically, if you take the uploaded ChartControlCrasher indicator and drop it on a chart it will run just fine. It draws a red box. If, however, you take that same indicator and instantiate it via the uploaded AnalyzerKiller strat by opening the strategy analyzer and doing a back test it will crash on the following line of code in @Shapes.cs at line 870.
    Code:
    [FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]startAnchor = [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af]ChartAnchor[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]((owner [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]as[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] Gui.NinjaScript.[/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af]IChartBars[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]).ChartBars.GetTimeByBarIdx(chartControl, currentBar - startBarsAgo), startY, currentBar, chartControl);
    [/SIZE][/FONT][/SIZE][/FONT]
    The reason it crashes is because chartControl is null.
    It's going to be null because there is no chart in the strategy analyzer.
    I can work around this by adding a property to my indicator that will allow me to tell the indicator that it is being run via a strat. I then would litter my code with if's to stop any drawing in this case. That, in my opinion is a god-awful hack and one I shouldn't have to do.

    BTW, I suspect the same problem would occur if you added the strat to the strategies tab of the control center.

    NT code should be smart enough to know when it's being run via the analyzer and IT should just return from anything that needs a non-null ChartControl object.

    NT code needs to be bullet proof. In general there is a shocking lack of exception handling. I shouldn't be able to crash NT code using standard NT calls. I don't know where else this problem is lurking, but better you guys fix it than all of us developers having to hack around the problem.
    My 2 cents.

    Thanks ... Ed
    Attached Files

    #2
    Hello edstaffin,

    What you are describing is a known bug being tracked with ID# NTEIGHT-9605.
    This has been corrected in NinjaTrader 8 Beta 11.

    It is important to remind you that NinjaTrader 8 is still in Beta. Currently, the public release is Beta 10. You will find that there are still bugs in NinjaTrader 8 Beta. In our Beta will not be "bullet proof" as the point of a Beta is to find bugs, report these, and have them corrected.

    If you are wanting to use a stable platform, please install NinjaTrader 7 our current stable platform and use this instead.
    http://ninjatrader.com/GetStarted
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks. I'm really glad to hear that a fix has already been made. I am anxiously awaiting b11.
      BTW, just because it's a beta doesn't mean you shouldn't have exception handling.
      Again, just my 2 cents.

      Comment


        #4
        Originally posted by NinjaTrader_ChelseaB View Post

        It is important to remind you that NinjaTrader 8 is still in Beta. Currently, the public release is Beta 10. You will find that there are still bugs in NinjaTrader 8 Beta. In our Beta will not be "bullet proof" as the point of a Beta is to find bugs, report these, and have them corrected.
        It should be slightly "idiot proof" overall. RED X's aren't really cool.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        657 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        373 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        109 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        574 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        579 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X