Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to tell whether a draw object exists?

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

    How to tell whether a draw object exists?

    Let's say I do a DrawRay("ABC"...) on my chart so that I have a draw object created. Is it possible to query to see if that object exists on the chart? I just want a true/false property or method to tell me if it exists or not.

    Thanks!

    #2
    Code:
    [FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][COLOR=blue][FONT=Courier New]foreach[/FONT][/COLOR][COLOR=black][FONT=Courier New](IDrawObject drawObject [/FONT][/COLOR][COLOR=blue][FONT=Courier New]in[/FONT][/COLOR][COLOR=black][FONT=Courier New] DrawObjects)[/FONT][/COLOR][/COLOR][/SIZE]
    [COLOR=#0000ff][SIZE=2][COLOR=black][FONT=Courier New]{[/FONT][/COLOR][/SIZE]
    [SIZE=2][COLOR=blue][FONT=Courier New]  if[/FONT][/COLOR][COLOR=black][FONT=Courier New] (drawObject.DrawType == DrawType.Ray && drawObject.Tag == [/FONT][/COLOR][COLOR=maroon][FONT=Courier New]"ABC"[/FONT][/COLOR][COLOR=black][FONT=Courier New])[/FONT][/COLOR][/SIZE]
    [SIZE=2][COLOR=black][FONT=Courier New]  {[/FONT][/COLOR][/SIZE]
    [SIZE=2][COLOR=green][FONT=Courier New]       // Do something here[/FONT][/COLOR][/SIZE]
    [SIZE=2][COLOR=blue][FONT=Courier New]       break[/FONT][/COLOR][COLOR=black][FONT=Courier New];[/FONT][/COLOR][/SIZE]
    [SIZE=2][COLOR=black][FONT=Courier New]  }[/FONT][/COLOR][/SIZE]
    [SIZE=2][COLOR=black][FONT=Courier New]}[/FONT][/COLOR][/SIZE]
    [/COLOR][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT]
    [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT]
    RayNinjaTrader Customer Service

    Comment


      #3
      Nice... thanks for exposing that object for us. :-)

      Also, you used to be able to click on and manually move or delete draw objects that were created by a Draw...() function. Now you have to remove the whole indicator that drew it. Is this intended functionality?

      Thanks again --

      Comment


        #4
        Originally posted by cassb View Post
        Also, you used to be able to click on and manually move or delete draw objects that were created by a Draw...() function. Now you have to remove the whole indicator that drew it. Is this intended functionality?
        It is default functionality. In Initialize() set:

        AllowRemovalOfDrawObjects = true;
        RayNinjaTrader Customer Service

        Comment


          #5
          The code provided by Ray seems to give access only to the user drawn drawobjects.

          Is there a way to get access to the drawobjects drawn by indicators?

          Is there a way to draw drawobjects programmatically in other panels than the price panel?
          Last edited by WolliWilli; 11-21-2009, 10:33 AM.

          Comment


            #6
            The DrawObjects colllection contains objects that are user drawn and drawn by the host indicator or strategy. There is no access to other objects drawn by other indicators etc...

            To draw in the indicator panel set the the following property to false in Initialize()

            DrawOnPricePanel = false;
            RayNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

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