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 kempotrader, Today, 08:56 AM
      0 responses
      7 views
      0 likes
      Last Post kempotrader  
      Started by kempotrader, Today, 08:54 AM
      0 responses
      4 views
      0 likes
      Last Post kempotrader  
      Started by mmenigma, Today, 08:54 AM
      0 responses
      2 views
      0 likes
      Last Post mmenigma  
      Started by halgo_boulder, Today, 08:44 AM
      0 responses
      2 views
      0 likes
      Last Post halgo_boulder  
      Started by drewski1980, Today, 08:24 AM
      0 responses
      4 views
      0 likes
      Last Post drewski1980  
      Working...
      X