• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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
    JoshNinjaTrader 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.
        JoshNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Sadat, Today, 09:09 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_JoshG  
        Started by login_dejavu, Today, 07:57 AM
        4 responses
        17 views
        0 likes
        Last Post login_dejavu  
        Started by Lender, Yesterday, 05:15 PM
        1 response
        13 views
        0 likes
        Last Post NinjaTrader_Jim  
        Started by rcmcd, Today, 07:52 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_PatrickG  
        Started by rcmcd, Today, 07:49 AM
        2 responses
        13 views
        0 likes
        Last Post rcmcd
        by rcmcd
         
        Working...
        X