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 Perr0Grande, Today, 08:16 PM
        0 responses
        2 views
        0 likes
        Last Post Perr0Grande  
        Started by elderan, Today, 08:03 PM
        0 responses
        4 views
        0 likes
        Last Post elderan
        by elderan
         
        Started by algospoke, Today, 06:40 PM
        0 responses
        10 views
        0 likes
        Last Post algospoke  
        Started by maybeimnotrader, Today, 05:46 PM
        0 responses
        9 views
        0 likes
        Last Post maybeimnotrader  
        Started by quantismo, Today, 05:13 PM
        0 responses
        7 views
        0 likes
        Last Post quantismo  
        Working...
        X