Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

'Draw' does not contain a definition for 'Line'

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

    'Draw' does not contain a definition for 'Line'

    I have a .NET Framework 4.8 DLL project that references:

    NinjaTrader.Core.dll
    NinjaTrader.Gui.dll
    NinjaTrader.Vendor.dll
    PresentationCore.dll

    I am calling:

    NinjaTrader.NinjaScript.DrawingTools.Draw.Line(... )

    VS is reporting error:

    'Draw' does not contain a definition for 'Line'.

    Draw.Text() is there but many other functions are not. I tried to reference NinjaTrader.Vendor.dll from several locations within NT but none have a Draw.Line().

    Where can I find the right Draw class?

    Thank you

    #2
    Hello AiTrading,

    NinjaTrader.NinjaScript.DrawingTools.Draw.Line is the correct namespace path.

    Note, drawing tools can only be called from an indicator or strategy (and no other script types) that is directly inheriting from the indicator or strategy class.
    Attached Files
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      This does not work in a DLL:

      Code:
      namespace NinjaTrader.NinjaScript.Indicators
      {
          public class xyz : Indicator
          {
              private Indicator IBase;
      
              public xyz(IndicatorRenderBase indicator)
              {
                  IBase = (Indicator)indicator;
              }
      
              public void Update()
              {
                  if (IBase.CurrentBar > 0)
                  {
                      Draw.Text(IBase, ...) // OK
                      Draw.Line(IBase, ...) // error
                  }
              }
          }
      }
      It appears that Draw.Line is in NinjaTrader.Custom.dll which I cannot reference from my DLL because it creates a reference loop. This is very unfortunate...

      Comment


        #4
        Hello AiTrading,

        Attached is an indicator that calls Draw.Line() exported as an assembly dll.

        Are you seeing the line appear on the chart?

        I'm also including the open source version so you can see the code.


        The code you have suggested in post #3, is not a valid indicator as it does not implement OnStateChange, or OnBarUpdate().
        Attached Files
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        563 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        329 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        547 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        548 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X