• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

problems using RemoveDrawObjects method

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

    problems using RemoveDrawObjects method

    Hi,

    I want to delete all chart objects using a button but I can't delete the lines, text ... using the RemoveDrawObjects or RemoveDrawObject methods. My Button is working and prints all chart objects into the output window but nothing is deleted, why?

    Thanks
    Mario

    Code:
    		private void ButtonClick(object s, EventArgs e) {
    			try{
    					foreach (IDrawObject draw in ChartControl.ChartObjects)
    					{	
    						if(draw.DrawType == DrawType.Line 
    							||draw.DrawType == DrawType.Ray
    							|| draw.DrawType == DrawType.HorizontalLine 
    							||draw.DrawType == DrawType.Ellipse 
    							|| draw.DrawType == DrawType.Rectangle 
    						){
    							RemoveDrawObject(draw.Tag);
    							Print(draw.Tag);
    						}
    					}				
    			}
    			catch(Exception ex){
    				Print("error: " +ex.ToString());
    			}
    			finally{
    				ChartControl.Refresh();
    			}
    		}

    #2
    Hello md236,

    Thank you for your note.

    The drawing objects you are attempting to remove, are these strategy/indicator drawn or manually drawn by the user?

    I look forward to your reply.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      the objects are drawn manually, I use a loop to set this objects invisible and back to visible, this works, but not the removing. How can I remove all objects within "ChartControl.ChartObjects"?

      Mario

      Comment


        #4
        Hello md236,

        Manually drawn objects cannot be removed via NinjaScript.

        Please let us know if you need further assistance.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          ChartControl.ChartObjects is an Array with IDrawObjects, right?
          Can I set this Array empty? Or, if I go to DrawingTools and click "Remove Drawing Objects" this is done by script, or not?

          Comment


            #6
            Hello md236,

            ChartControl.ChartObjects is a collection.

            Setting above to null would not be supported.

            Removing manually drawn objects via a script is not supported.

            Please let us know if you need further assistance.
            Alan P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Atilla, Today, 04:05 PM
            0 responses
            15 views
            0 likes
            Last Post Atilla
            by Atilla
             
            Started by Displacer, Today, 02:57 PM
            2 responses
            13 views
            0 likes
            Last Post Displacer  
            Started by SAILIKITY, 05-22-2019, 05:41 PM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_PaulH  
            Started by rmillar, 01-09-2019, 06:02 PM
            6 responses
            74 views
            1 like
            Last Post eDanny
            by eDanny
             
            Started by mlarocco, Today, 11:39 AM
            4 responses
            23 views
            0 likes
            Last Post mlarocco  
            Working...
            X