Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Labelled lines

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

    Labelled lines

    Just a little feedback for the author (NT staff, I believe).

    To prevent unhandled 'null' errors (object reference not set to an instance of an object), labeled lines onRender needs to be updated with the following (or some equivalent), because you will still get an "NinjaTrader.NinjaScript.DrawingTools.DrawingTool. **GetAttachedToChartBars**(...) returned null." error with the current null detection

    Code:
            public override void OnRender(ChartControl chartControl, ChartScale chartScale)
            {
                base.OnRender(chartControl, chartScale);
    
                Stroke.RenderTarget         = RenderTarget;
                OutlineStroke.RenderTarget    = RenderTarget;
    
    [I]            try
                {
                    if (GetAttachedToChartBars().Bars.Instrument.MasterInstrument == null)
                        return;
                }
                catch
                {
                    return;
                }[/I]
    Regards,

    Paul

    #2

    Try this instead

    Code:
    ChartBars tcbs = AttachedTo.ChartObject as ChartBars;
    if(tcbs == null) { Print("ChartBar Problem"); return; }


    -=Edge=-
    NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

    Comment


      #3
      Thank you, Sir! Have a great weekend.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by TraderG23, 12-08-2023, 07:56 AM
      9 responses
      382 views
      1 like
      Last Post Gavini
      by Gavini
       
      Started by oviejo, Today, 12:28 AM
      0 responses
      1 view
      0 likes
      Last Post oviejo
      by oviejo
       
      Started by pechtri, 06-22-2023, 02:31 AM
      10 responses
      125 views
      0 likes
      Last Post Leeroy_Jenkins  
      Started by judysamnt7, 03-13-2023, 09:11 AM
      4 responses
      59 views
      0 likes
      Last Post DynamicTest  
      Started by ScottWalsh, Yesterday, 06:52 PM
      4 responses
      36 views
      0 likes
      Last Post ScottWalsh  
      Working...
      X