Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnRender - Gaps between prices - A hint, please!

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

    OnRender - Gaps between prices - A hint, please!

    Hi,

    I'm trying to draw some profiles in OnRender. It works OK. I'm just drawing rectangles. One issue I noticed is that if I draw 2 rectangles at 2 adjacent prices, say, 900.25 and 900.50, and make the height of that rectangle the difference of the y co-ordinate between the 2, I sometimes get gaps. These gaps will appear and disappear and seemingly random spots as you scale the chart. A picture I am sure will be better at explaining it, so, below... It only happens occasionally, but it looks a bit naff. I can play around with trying to pad a pixel or so, but in many cases, it's not needed and applying to all wrecks the shape.

    So, a little advice, please. I am sure NT or someone here has come across this. A hint as to how you handle it will be most appreciated. Thanks.

    Click image for larger version

Name:	NinjaTrader_BlCy7nruwH.png
Views:	375
Size:	8.3 KB
ID:	1127832

    #2
    Hello pjsmith, thanks for writing in.

    This output is going to depend on exactly what the OnRender method is doing. The open source default Volume Profile indicator uses OnRender to plot it's histogram, that would be the best example to use to complete a project like this. To find what is causing the issue in your script specifically, you would need to look into what is being used to determine the location of the rendered objects.

    Best regards,
    -ChrisL.

    Comment


      #3
      Thanks. I'll take a look.

      I was getting my Y coordinates like this

      y1 = chartSca le.GetYByValue(entry.Key+(TickSize/2));
      y2 = chartSca le.GetYByValue(entry.Key-(TickSize/2));

      So, always increments of 1 tick. I'm calculating with hight with 'y1-y2', which gives me the Y difference. As all plots are adjacent, the spaces were a little confusing. I'd come across this before, but not sought to resolve it.

      I think it's the fractional issue from /2. I'll try something else. Thanks again.

      [edit] Sorted! A Math.Max(1,y2 - y1) instead of y2 - y1 solves the problem.
      Last edited by pjsmith; 11-16-2020, 01:45 PM.

      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