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

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

      Paul H.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by llanqui, Today, 08:32 AM
      1 response
      5 views
      0 likes
      Last Post llanqui
      by llanqui
       
      Started by lollers, Yesterday, 03:26 AM
      1 response
      51 views
      0 likes
      Last Post lollers
      by lollers
       
      Started by Salahinho99, 05-05-2024, 04:13 AM
      7 responses
      59 views
      0 likes
      Last Post Salahinho99  
      Started by knighty6508, 05-10-2024, 01:20 AM
      4 responses
      29 views
      0 likes
      Last Post knighty6508  
      Started by OllieFeraher, 05-09-2024, 11:14 AM
      6 responses
      19 views
      0 likes
      Last Post OllieFeraher  
      Working...
      X