Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Need help writing code for a rectangle that extends right until...

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

    Need help writing code for a rectangle that extends right until...

    So far I have Draw.Rectangle(this,"Rect1", Swing(10).SwingHigh[20],MAX(High, 20)[0],)

    I looked up Ray and it is to draw a line. I tried extend lines right/left(Fibonacci Retracement), extend reference doesn't exist in the help guide.
    Need help writing code for a rectangle that extends right until price closes above the high/below the low of the rectangle

    #2

    Comment


      #3
      Hello jamestrader21x,

      Thanks for your post.

      Your screenshot is from a Ninjatrader7 screen and you are posting in NinjaTrader8 indicator development. Your code appears to be for NinjaTrader8.

      Basically what you would need to do is to determine the high and low of the rectangle and the start bars ago (or date time) and draw to the Current bar (or time). You would want to save the rectangles' High value, low value and start bar of the rectangle into variables so that you can redraw the rectangle on each OnBarUpdate().

      On each OnBarUpdate() you would redraw the rectangle to the currentbar and check to see if price has crossed the rectangle low or high and at that point stop (redrawing) the rectangle.

      I've added an example script that draws a rectangle, save the values and then redraws on each update as long as price does not cross.

      It will draw on the completion of the first real time bar (so maybe add to a quick chart like 10 second bars).

      RectangleExample.zip

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      648 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      369 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      108 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      572 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      574 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X