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

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.
    Brandon H.NinjaTrader Customer Service

    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 Tin34, Today, 03:30 AM
        2 responses
        15 views
        0 likes
        Last Post Tin34
        by Tin34
         
        Started by sastrades, Yesterday, 09:59 AM
        2 responses
        28 views
        0 likes
        Last Post brucerobinson  
        Started by ETFVoyageur, Today, 12:52 AM
        1 response
        14 views
        0 likes
        Last Post Leeroy_Jenkins  
        Started by lollers, Today, 03:26 AM
        0 responses
        10 views
        0 likes
        Last Post lollers
        by lollers
         
        Started by aliyahany, Today, 03:16 AM
        0 responses
        2 views
        0 likes
        Last Post aliyahany  
        Working...
        X