Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Keeping Old Drawing Objects

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

    Keeping Old Drawing Objects

    Hello All-

    I created a script that uses the Draw.Rectangle code to highlight an area when a custom three candlestick pattern occurs. It works as it should but when that 3 candlestick pattern occurs again the previous rectangle disappears when the new one is drawn on the chart.

    How do I keep the old rectangle objects on the chart even when a new one is drawn?

    Thank you,

    Nick

    #2
    Hello njmeyer713,

    Thanks for your post.

    You must assign a unique Tag name to the Draw method to have the previous drawings remain on the chart when the condition to draw a new object becomes true.

    From the Draw.Rectangle() help guide page linked below: "..if you pass in a value of "myTag", each time this tag is used, the same draw object is modified. If unique tags are used each time, a new draw object will be created each time."

    The code might look something like this: Draw.Rectangle(this, "tag1" + CurrentBar, 10, Low[10] - TickSize, 5, High[5] + TickSize, Brushes.Blue);

    Draw.Rectangle(): https://ninjatrader.com/support/help..._rectangle.htm

    Let me know if I may assist further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Brandon-

      Quick and easy response that works. Thank you for that, I appreciate it.

      Comment


        #4
        there should be pop up tool tips that let you know of this.
        good info!

        Comment

        Latest Posts

        Collapse

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