Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Proper way to add assembly reference in NT8?

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

    Proper way to add assembly reference in NT8?

    My indicator will use the Plot method.

    Code:
    public override void Plot(Graphics graphics, Rectangle bounds, double min, double max)
    within this I'll need to use SolidBrush etc so I need to add a reference to System.Drawing.

    What's the proper way to add a reference to an assembly in NinjaTrader 8? It's simply a matter of editing Config.xml and adding the following?

    <References>
    <ArrayOfString xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <string>System.Drawing.dll</string>

    Or should I be right-clicking in the indicator and choosing References -> add? And if I use the References menu option where should I navigate to find System.Drawing.dll (on a 64-bit system using NT 8 64-bit)?

    Is there a difference between these two methods?

    #2
    Hello overflowing,

    With NinjaTrader 8, there will no plot method to override. Instead this will be done in OnRender().

    http://ninjatrader.com/support/helpGuides/nt8/en-us/onrender.htm


    Further, rending will be done with sharpdx which means items will be drawn with BrushDX brushes instead of SolidColorBrushes.
    http://ninjatrader.com/support/helpG.../drawline2.htm
    http://ninjatrader.com/support/helpG...rectangle2.htm
    http://ninjatrader.com/support/helpG...ndertarget.htm

    To add a reference to NinjaTrader this can be done through the NinjaScript editor the same as it would be done for NinjaTrader 7. Right-click the NinjaScript editor -> select References... -> select the reference -> click OK.

    Then in the calling script add a using statement to the namespace in the referenced file.

    You will not need to add a reference to System.Drawing. This is already referenced in NinjaTrader. Try typing System.Drawing. in a script, the intelliview will open and show you what is available to the already referenced System.Drawing.

    However, if you want your script to perform, you will want to draw using the RenderTarget so that rendering is done on the GPU instead of the CPU.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      In my Config.Xml I do not see a reference to System.Drawing.dll

      Can you elaborate a little on Config.xml references section? When I add a reference via the user interface does this file get modified?

      Also what is RenderTarget? Is that a global or class that I call static methods on?

      Comment


        #4
        Hello overflowing,

        I double checked and found the System.Drawing reference was dropped because there should be no drawing with System.Drawing in NinjaTrader 8.

        You would need to manually add this reference.

        The RenderTarget will be the object that contains all of the lines, rectangles, and circles that will be rendered in each pass. This is created behind the scenes for any script that is added to a chart such as Indicators, Drawing tools, and Strategies.
        https://msdn.microsoft.com/en-us/lib...tudio.31).aspx

        Try taking a look at any of the drawing tools, or the VolumeZones indicator that shows how to draw using sharpdx.
        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
        649 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        370 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
        573 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        576 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X