Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 bortz, 11-06-2023, 08:04 AM
      47 responses
      1,607 views
      0 likes
      Last Post aligator  
      Started by jaybedreamin, Today, 05:56 PM
      0 responses
      9 views
      0 likes
      Last Post jaybedreamin  
      Started by DJ888, 04-16-2024, 06:09 PM
      6 responses
      19 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by Jon17, Today, 04:33 PM
      0 responses
      6 views
      0 likes
      Last Post Jon17
      by Jon17
       
      Started by Javierw.ok, Today, 04:12 PM
      0 responses
      15 views
      0 likes
      Last Post Javierw.ok  
      Working...
      X