Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Drawing Rectangle on Bar

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

    Drawing Rectangle on Bar

    Hi,

    Im hoping someone can assist here. I'm currently using Renko bars for trading.
    I've developed a simple indicator that shows how much a bar would need to move to get a new renko bar (green or red). It includes the Pips required to move and the Price that a new bar will be created on.

    Here's my issue, while the indicator logic works fine, the visual part of it is misaligned with the current bar.

    I've tried several approaches:
    Using "bars ago" draws the rectangle from the middle of the previous bar to the current bar
    Using "Start/End Date" allows me more control but I still cant get it the full width of the bar and it also does not resize.

    I've attached a screenshot of both issues and my desired result. I'm sure it must be something simple I'm missing - can anyone point me in the right direction?

    Thanks.
    Attached Files

    #2
    Hello spook202,

    Likely you are using Draw.Rectangle() which is designed to be drawn from the center of a bar to the center of another bar.

    To draw a rectangle the way you are presenting, this would require custom rendering in OnRender() using custom x and y values converted from the bar times.

    Below is a link to an example called ClickDraw to assist in getting started with custom rendering.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks Chelsea, got it working with your links

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      71 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      152 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      162 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      100 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      288 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Working...
      X