Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DrawObject Programmatically drawn, interactively deleted?

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

    DrawObject Programmatically drawn, interactively deleted?

    Hello I have a problem understanding the Ninja behaviour concering DrawObjects in an Indicator.

    In my code I generate a rectangle after a MouseClick (using TriggerCustomEvent).

    I use always the same tag for the iRect and therefore with each new mouseclick the rectangle position is updated.
    This all works, but there is a problem when the user removes the Rectangle manually from the Chart.
    In this case my code will fail and I cannot update the iRect postion any more and I get an error from Ninja in the trace.

    Remember the rectangle was drawn programmatically by a call to DrawRect. It is removed by the user.
    Actually I am happy with this and I want the user to be able to remove it .

    In my code I can also detect if the iRect is visible or not (and or disposed), but once the iRect was removed by the user I cannot use the originally used tag any more to draw a new rectangle.

    My questions:
    1. Is this by design? So once the user has removed an IRectangle this is flagged as "don't use" and I have to change the tag?

    2. The smartest solution would be to use the ChartControl.ChartObjectChanged Event Handler and attach Handler to it. But it nver gets fired.Could you please enlight it' s use. When does it get fired? hank you



    Best regards
    andreas

    below code snipped and trace


    MyInteractiveIndicator:Indicator {
    IRectangle iRect=null;
    MyCustomEventMouseClicked(){
    if(CTRL+LMOUSEBUTTON){
    iRect=DrawRect(...);
    }
    }


    THIS TRACE BELOW ONLY IF iRECT REMOVED BY USER:

    2009-12-20 15:20:38:412 in OnUnhandledThreadException
    2009-12-20 15:20:38:412 ********* exception trapped *********
    2009-12-20 15:20:38:412 Parameter is not valid.
    2009-12-20 15:20:38:412 at System.Drawing.Pen.get_Width()
    at NinjaTrader.Gui.Chart.ChartShape.IsOutlineVisible( ChartControl chartControl, Int32 x, Int32 y)
    at NinjaTrader.Gui.Chart.ChartRectangle.IsOutlineVisi ble(ChartControl chartControl, Int32 x, Int32 y)
    at NinjaTrader.Gui.Chart.ChartControl.GetSelectedChar tObject(MouseEventArgs e)

    #2
    Andreas, thank you for reporting this. We will look into it.
    AustinNinjaTrader Customer Service

    Comment


      #3
      same behaviour in b6,

      Comment


        #4
        OK, all working.

        I got the event firing using another event handler.

        Just doing this while watching the evening TV...
        Ninja is so powerfull!
        It is the first trading software that allows me actually to implement everything I can invent. The limitation is usually me and rarely NinjaTrader.

        compliments

        For my Ninja addon all works fine: I just installed the new beta6 and all works seamless , no problems. All perfect!
        (maybe I will run into a limitation doing Neural Network backpropagation... not yet)


        Have a nice chrismass

        Andreas

        www.zweisteintrading.eu
        Last edited by zweistein; 12-21-2009, 02:45 PM.

        Comment


          #5
          Thanks. To clarify: this no longer is an issue for you?

          Comment


            #6
            Hello again,


            actually no issue, but a question?

            We have DrawObjectCollection.InsertComplete
            .ClearComplete and .RemoveComplete

            I don't get the difference between .ClearComplete and RemoveComplete

            In my situatiuon when I move an object on the chart I get
            .clearcomplete
            .insertcomplete

            sequences, but removecomplete is never called.

            I would assume that the DrawObject tag stays "occupied" until removecomplete,

            but when is removecomplete called?

            Regards

            Andreas

            Comment


              #7
              Sorry I don't follow. I could not find "DrawObjectCollection" in the NT sources. Please be specific.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              599 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              345 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              103 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              558 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              558 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X