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

Converting from NT7 to NT8

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

    Converting from NT7 to NT8

    Is there an equivalent to NT7 Rectangle for NT8. The NT8 Rectangle lacks x, y, width, and height.
    It looks like NT7 was coming from System.Drawing and NT8 is coming System,Windows.Media

    Thanks

    #2
    Hello jeliner,

    What is the specific line of code?

    If you are asking about DrawRectangle(), for NT7 this had a startBarsAgo, startY, endBarsAgo, and endY.
    DrawRectangle(string tag, int startBarsAgo, double startY, int endBarsAgo, double endY, Color color)
    https://ninjatrader.com/support/help...wrectangle.htm

    The equivalent for NT8 is Draw.Rectangle() and has these same overload parameters.
    Draw.Rectangle(NinjaScriptBase owner, string tag, int startBarsAgo, double startY, int endBarsAgo, double endY, Brush brush)
    https://ninjatrader.com/support/help..._rectangle.htm

    The code equivalents to NT8 from NT7, can be found with the filter in the 'Code Breaking Changes' section of the help guide.
    https://ninjatrader.com/support/help...ng_changes.htm


    If you are referring to overriding the Plot() method and custom rendering with GDI+, this was not supported for NinjaTrader 7 so there is no documentation in the NinjaTrader 7 help guide.
    Custom rendering is supported with SharpDX with NinjaTrader 8.
    Because custom rendering with GDI+ is not supported for NinjaTrader 7, the equivalents for rendering objects is not listed in the code breaking changes.

    That said, you can render a rectangle with SharpDX with RenderTarget.DrawRectangle().
    https://ninjatrader.com/support/help...wrectangle.htm
    https://ninjatrader.com/support/help.../rendering.htm

    See the SampleCustomRender indicator included with NinjaTrader for an example of custom rendering.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello jeliner,

      What is the specific line of code?

      If you are asking about DrawRectangle(), for NT7 this had a startBarsAgo, startY, endBarsAgo, and endY.
      DrawRectangle(string tag, int startBarsAgo, double startY, int endBarsAgo, double endY, Color color)
      https://ninjatrader.com/support/help...wrectangle.htm

      The equivalent for NT8 is Draw.Rectangle() and has these same overload parameters.
      Draw.Rectangle(NinjaScriptBase owner, string tag, int startBarsAgo, double startY, int endBarsAgo, double endY, Brush brush)
      https://ninjatrader.com/support/help..._rectangle.htm

      The code equivalents to NT8 from NT7, can be found with the filter in the 'Code Breaking Changes' section of the help guide.
      https://ninjatrader.com/support/help...ng_changes.htm


      If you are referring to overriding the Plot() method and custom rendering with GDI+, this was not supported for NinjaTrader 7 so there is no documentation in the NinjaTrader 7 help guide.
      Custom rendering is supported with SharpDX with NinjaTrader 8.
      Because custom rendering with GDI+ is not supported for NinjaTrader 7, the equivalents for rendering objects is not listed in the code breaking changes.

      That said, you can render a rectangle with SharpDX with RenderTarget.DrawRectangle().
      https://ninjatrader.com/support/help...wrectangle.htm
      https://ninjatrader.com/support/help.../rendering.htm

      See the SampleCustomRender indicator included with NinjaTrader for an example of custom rendering.
      The code is primarily using Rectangle from System.Drawing to hold, manage, and evaluate X/Y coordinates. I think most of issues would be resolved if I simply removed System.Windows.Media as using statement and add System.Drawing as well as creating a reference to that name space. IWhat was the motivation to move from the System.Drawing namespace? Would there be any negative consequences in using that instead of System.Windows.Media?

      Comment


        #4
        Hello jeliner,

        You would not be able to draw. NinjaTrader 8 uses a SharpDX rendering space and does not use a GDI+ (System.Windows.Media) rendering space.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by fafafdenis, Today, 04:56 PM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_EricB  
        Started by pjsmith, 07-18-2019, 04:21 AM
        7 responses
        247 views
        0 likes
        Last Post aligator  
        Started by ark321, Today, 05:12 PM
        0 responses
        8 views
        0 likes
        Last Post ark321
        by ark321
         
        Started by futurenow, Today, 04:49 PM
        0 responses
        9 views
        0 likes
        Last Post futurenow  
        Started by ofer1964spivak, Today, 04:27 PM
        0 responses
        5 views
        0 likes
        Last Post ofer1964spivak  
        Working...
        X