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

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 wzgy0920, 04-20-2024, 06:09 PM
        2 responses
        26 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, 02-22-2024, 01:11 AM
        5 responses
        32 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, Yesterday, 09:53 PM
        2 responses
        49 views
        0 likes
        Last Post wzgy0920  
        Started by Kensonprib, 04-28-2021, 10:11 AM
        5 responses
        192 views
        0 likes
        Last Post Hasadafa  
        Started by GussJ, 03-04-2020, 03:11 PM
        11 responses
        3,234 views
        0 likes
        Last Post xiinteractive  
        Working...
        X