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 DanielTynera, Today, 01:14 AM
      0 responses
      2 views
      0 likes
      Last Post DanielTynera  
      Started by yertle, 04-18-2024, 08:38 AM
      9 responses
      40 views
      0 likes
      Last Post yertle
      by yertle
       
      Started by techgetgame, Yesterday, 11:42 PM
      0 responses
      9 views
      0 likes
      Last Post techgetgame  
      Started by sephichapdson, Yesterday, 11:36 PM
      0 responses
      2 views
      0 likes
      Last Post sephichapdson  
      Started by bortz, 11-06-2023, 08:04 AM
      47 responses
      1,615 views
      0 likes
      Last Post aligator  
      Working...
      X