Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 terofs, Today, 04:18 PM
        0 responses
        1 view
        0 likes
        Last Post terofs
        by terofs
         
        Started by nandhumca, Today, 03:41 PM
        0 responses
        4 views
        0 likes
        Last Post nandhumca  
        Started by The_Sec, Today, 03:37 PM
        0 responses
        3 views
        0 likes
        Last Post The_Sec
        by The_Sec
         
        Started by GwFutures1988, Today, 02:48 PM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by ScottWalsh, 04-16-2024, 04:29 PM
        6 responses
        33 views
        0 likes
        Last Post ScottWalsh  
        Working...
        X