Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT8: Extending a rectangle in Ninjascript

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

    NT8: Extending a rectangle in Ninjascript

    Greetings

    My intent is to extend a rectangle that has been created via Ninjascript under certain conditions. The following code does not work:

    Rect rect = Draw.Rectangle(this, tag, false, 2,
    High[2], 0, Low[2], Brushes.Black,
    Brushes.Gray, 1);
    ...
    ...
    ...

    rect.EndAnchor.BarsAgo = 0;

    The alternative is to just create another rectangle with the same tag as the current one. This is a highly inefficient way of achieving this goal.

    Please advise.

    Thanks in advance.




    #2
    Hello svrz,

    Thank you for the question.

    The suggestion in this case would be to call the Draw method again to update the object with the same tag, this is the normal way to update a drawing object. If you are seeing performance impacts due to using many objects, it is generally suggested to instead use OnRender to do the drawing.

    I look forward to being of further assistance.

    Comment


      #3
      Thank you, Jesse. This is a simple drawing operation hence there does not seems to be any performance issues with the re-drawing of the rectangles.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      40 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      20 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      27 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      45 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      37 views
      0 likes
      Last Post CarlTrading  
      Working...
      X