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 andrewtrades, Today, 04:57 PM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by chbruno, Today, 04:10 PM
      0 responses
      6 views
      0 likes
      Last Post chbruno
      by chbruno
       
      Started by josh18955, 03-25-2023, 11:16 AM
      6 responses
      436 views
      0 likes
      Last Post Delerium  
      Started by FAQtrader, Today, 03:35 PM
      0 responses
      7 views
      0 likes
      Last Post FAQtrader  
      Started by rocketman7, Today, 09:41 AM
      5 responses
      19 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X