Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnRender() Not Working Correctly When Adding a Tick Series

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

    OnRender() Not Working Correctly When Adding a Tick Series

    Issue Description:


    I'm developing an indicator in NinjaTrader that uses a secondary tick series along with the primary time-based series. The indicator draws a rectangle on the chart using the OnRender() method. When the indicator is loaded, the rectangle is drawn correctly, but as the price updates, the rectangle disappears instead of moving dynamically with the price. This behavior only occurs when I add the tick series. Key Observations:
    1. Normal behavior without the tick series:
      • If I remove the tick series, the OnRender() method works as expected: the rectangle is drawn and moves dynamically with price updates. This indicates that the rendering logic in OnRender() works correctly in a time-based series environment.
    2. Behavior with the tick series:
      • When I add the tick series (AddDataSeries(BarsPeriodType.Tick, 1)), the rectangle initially appears but disappears as soon as the price changes. This suggests that adding the tick series interferes with the rendering cycle.
    3. Calculations in OnBarUpdate():
      • The volume and price calculations for the tick series are handled in the OnBarUpdate() method under BarsInProgress == 1. No complex calculations or graphical updates are performed in OnBarUpdate(), beyond updating variables to handle buy and sell deltas.
    4. Not using InvalidateVisual() inside OnRender():
      • I have avoided calling InvalidateVisual() inside OnRender() to prevent a redraw loop. However, I am still facing issues with dynamically rendering the rectangle when combined with the tick series.
    Possible Cause:


    It seems that the high frequency of updates from the tick series is interfering with the rendering cycle, causing the chart to stop rendering properly as the price updates in real-time. This may be due to NinjaTrader prioritizing tick updates over the rendering process or that constant data updates are interrupting the OnRender() cycle. Question:


    How can I prevent the OnRender() cycle from being disrupted by the tick series? Is there any recommended approach to handle tick series while maintaining dynamic rendering without the graphics disappearing?

    Find the code in the attachment.
    Attached Files

    #2
    Solved, by using double maxPrice = BarsArray[0].GetHigh(CurrentBars[0]);
    double minPrice = BarsArray[0].GetLow(CurrentBars[0]);​

    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