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 DannyP96, 05-18-2026, 02:38 PM
        1 response
        85 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        143 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        83 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        256 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        334 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X