Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator: drawing under "OnRender"

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

    Indicator: drawing under "OnRender"

    Hi,

    I'm trying to draw different geometries and text, which I cannot do properly with "Draw.Line" giving only price and bar coordinates.

    I've learnt, that this can be done under "OnRender" using screen coordinates instead pirce and bar.
    Please confirm me if there is another method or posibility to do it.

    My question now is, when will be this "OnRender" be activated?
    The indicator can be updated at the end of each bar, for example, but when will be updated this "OnRender".
    I know that I should't use too many calculations inside OnRender, but thera are some variables, which I need from the screen, thus I have to do this calculations inside OnRender.

    Maybe you can give some tips or examples in order to understand it better.

    Thanks in advance!

    #2
    Hello artson,

    Thank you for your post.

    That is correct. SharpDX methods could be used to render objects on a chart window with OnRender(). The OnRender() method frequently runs once the State has reached State.Realtime in response to market data updates or a user interacting with the chart (e.g., clicking, resizing, rescaling, etc.). For performance optimizations, the timing of the calls to OnRender() are buffered to at least 250ms, and re-renders once internal logic determines that values may be out-of-date.

    Please see the help guide documentation below for more information about using SharpDX for custom chart rendering. Also, see the SampleCustomRender script that comes default with NinjaTrader for an example of how to use SharpDX and OnRender().

    To view the SampleCustomRender script, open a New > NinjaScript Editor window, double-click the Indicators folder, then select SampleCustomRender to view the code.

    Using SharpDX for Custom Chart Rendering - https://ninjatrader.com/support/help..._rendering.htm
    OnRender() - https://ninjatrader.com/support/help...8/onrender.htm

    Please let us know if we may assist further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Thanks Brandon,

      So, it is not possible to "control" when or how often the OnRender will be processed?

      Comment


        #4
        Hello artson,

        Thank you for your note.

        That is correct, OnRender() is controlled by internal logic. OnRender is called on a 250ms timer on charts and additionally called anytime the visuals are invalidated e.g., resizing the screen or adding and removing indicators for example.

        Please let us know if we may assist further.
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment


          #5
          Perfect!
          Thanks a lot!!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          576 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          334 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          553 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          551 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X