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

SharpDX vs. Draw Method

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

    SharpDX vs. Draw Method

    I use several indicators that generate a lot of lines, rays, and text objects on a chart. They are rendered using the Draw method.

    I was wondering if there is a benefit in using SharpDX instead? Primarily I want to know if there is a performance different between the two options? Is there some guidance documentation that would help decide when to use the Draw method vs. SharpDX?

    #2
    The big distinction here is that SharpDX drawing requires a RenderTarget, and OnRender provides a ready-made RenderTarget for you. Thus, you will want to do your SharpDX work within that event. NinjaScript drawing methods (Draw.X) have no such requirement, and are already connected to logic related to slot indexes and the x- and y-axis, so you can call them in a greater scope.

    Help Guide - Using SharpDX for Custom Chart Rendering
    Help Guide - SharpDX SDK Reference
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      I understand the difference in implementation. I have created an indicator using SharpDX as well. What I have a hard time finding is information on the performance difference between the two options. And how to decide which to use when both options provide a feature like drawing a simple line or rendering some text. Is there some decision guidance somewhere? Or performance recommendation/comparison?

      If there is a performance improvement using SharpDX is might consider converting my indicators to using it.

      Comment


        #4
        I am not aware of any type of performance comparison. However, I can tell you that using OnRender() is going to give you much better performance.

        When you use the Draw methods they must store bar and timestamp information and related information in memory before getting rendered on your chart. When you use SharpDX you are essentially cutting out the middle man and rendering it directly on the chart.
        Josh G.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Gerik, Today, 09:40 AM
        2 responses
        7 views
        0 likes
        Last Post Gerik
        by Gerik
         
        Started by RookieTrader, Today, 09:37 AM
        2 responses
        11 views
        0 likes
        Last Post RookieTrader  
        Started by alifarahani, Today, 09:40 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by KennyK, 05-29-2017, 02:02 AM
        3 responses
        1,285 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by AttiM, 02-14-2024, 05:20 PM
        11 responses
        186 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X