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.
    JesseNinjaTrader Customer Service

    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 rhyminkevin, Today, 04:58 PM
      1 response
      34 views
      0 likes
      Last Post Anfedport  
      Started by iceman2018, Today, 05:07 PM
      0 responses
      4 views
      0 likes
      Last Post iceman2018  
      Started by lightsun47, Today, 03:51 PM
      0 responses
      7 views
      0 likes
      Last Post lightsun47  
      Started by 00nevest, Today, 02:27 PM
      1 response
      14 views
      0 likes
      Last Post 00nevest  
      Started by futtrader, 04-21-2024, 01:50 AM
      4 responses
      49 views
      0 likes
      Last Post futtrader  
      Working...
      X