Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

InsertComplete

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

    InsertComplete

    How would I convert this to NT8? I'm just not seeing it..

    Code:
    ChartControl.ChartObjects.InsertComplete






    -=Edge=-
    NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

    #2
    Hello Edge,

    Thank you for your post.

    There would not be an equivelent to ChartControl.ChartObjects.InsertComplete. What are you trying to accomplish? Why were you using InsertComplete in NinjaTrader 7?

    I look forward to your response.
    Patrick H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_PatrickH View Post
      Hello Edge,

      Thank you for your post.

      There would not be an equivelent to ChartControl.ChartObjects.InsertComplete. What are you trying to accomplish? Why were you using InsertComplete in NinjaTrader 7?

      I look forward to your response.
      I am using it in conjunction with a button click to create this event

      Code:
      private void myMethod(object sender, CollectionEventArgs e) { }
      But the CollectionEventArgs no longer exits either.. and am thinking that maybe I could use this instead..

      Code:
      private void myMethod(object sender, ObservableCollectionEventArgs<T>  e) { }
      I believe I have the method working fine, but am struggling with how to create the new event.. Can you point me in the right direction please?




      Edit - Modified to button click event...
      Last edited by -=Edge=-; 06-17-2015, 09:51 AM.
      -=Edge=-
      NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

      Comment


        #4
        There are no public events that would match here, we'd like to know how you're using that in NT7 (what exactly are you trying to hook on to? Notify when an instrument changes? An indicator has been added? Drawing tool changed?) so we can provide an existing equivalent in NT8 which would accomplish your goal, or check back with development if there should be something internal that needed to be exposed for your task.
        MatthewNinjaTrader Product Management

        Comment


          #5
          Originally posted by NinjaTrader_Matthew View Post
          There are no public events that would match here, we'd like to know how you're using that in NT7 (what exactly are you trying to hook on to? Notify when an instrument changes? An indicator has been added? Drawing tool changed?) so we can provide an existing equivalent in NT8 which would accomplish your goal, or check back with development if there should be something internal that needed to be exposed for your task.
          It would probably be easier and much quicker to show you than try to explain in words.. Would this be possible? Skype - edge358 just in case..


          Last edited by -=Edge=-; 06-17-2015, 10:59 AM.
          -=Edge=-
          NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

          Comment


            #6
            Originally posted by NinjaTrader_Matthew View Post
            There are no public events that would match here, we'd like to know how you're using that in NT7 (what exactly are you trying to hook on to? Notify when an instrument changes? An indicator has been added? Drawing tool changed?) so we can provide an existing equivalent in NT8 which would accomplish your goal, or check back with development if there should be something internal that needed to be exposed for your task.
            This is totally unrelated to what I'm trying to do above, but since you brought it up.. Is there any way of hooking to an event when an indicator has been manually deleted from the chart..

            Not so much when it's done thru the indicator property menu, but when you click on the indicator to select it and either use the context menu to remove and/or hit the delete key to delete it from the chart?


            -=Edge=-
            NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

            Comment


              #7
              Originally posted by -=Edge=- View Post
              This is totally unrelated to what I'm trying to do above, but since you brought it up.. Is there any way of hooking to an event when an indicator has been manually deleted from the chart..

              Not so much when it's done thru the indicator property menu, but when you click on the indicator to select it and either use the context menu to remove and/or hit the delete key to delete it from the chart?


              I should think that the Garbage Collector would handle that, as there would no longer be a reference to the subscribed instance of the eventHandler in any running code.

              Otherwise, I think that OnTermination() would be run before the indicator is removed, so one can unsubscribe there explicitly (which you would have already coded anyway ).
              Last edited by koganam; 06-17-2015, 12:26 PM.

              Comment


                #8
                Originally posted by koganam View Post
                I should think that the Garbage Collector would handle that, as there would no longer be a reference to the subscribed instance of the eventHandler in any running code.

                Otherwise, I think that OnTermination() would be run before the indicator is removed, so one can unsubscribe there explicitly (which you would have already coded anyway ).
                It was actually just a thought around how I might code around an existing issue, but that alone wouldn't completely solve my problem anyway.. So please don't worry about answering..

                Currently if you add any type of new button, panel, toolbar, grid, etc to the chart itself (as a child of the ChartControl) thru an indicator, whenever the main grid is updated (for instance after a manual indicator deletion, a change in dataseries property, and possibly even other things that I've yet to run across) it looses track of those objects that were added, and currently the indicator needs to be reloaded to get them back..

                I guess what might work is a way of hooking into the grid update event handler, and then forcing the indicator to reload automatically.. But this is already a known issue, and I'm sure they'll come up with something for us..


                -=Edge=-
                NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

                Comment


                  #9
                  The ChartScales has as ChartObjects object which is an observable collection and therefore has a CollectionChanged NotifyCollectionChangedEvent. The attached should demonstrate how to use this undocumented feature.
                  Attached Files
                  MatthewNinjaTrader Product Management

                  Comment


                    #10
                    Originally posted by NinjaTrader_Matthew View Post
                    The ChartScales has as ChartObjects object which is an observable collection and therefore has a CollectionChanged NotifyCollectionChangedEvent. The attached should demonstrate how to use this undocumented feature.
                    Works perfectly! Thanks!!


                    -=Edge=-
                    NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

                    Comment


                      #11
                      Hi...
                      Once we have the object changed...

                      Print(e.NewItems[0].ToString() + " was added");

                      How can we get its details ?

                      I got this ;
                      IDrawingTool x = (IDrawingTool) e.NewItems[0];
                      Print("Name = " + x.Name ) ;
                      Print("Tag = " + x.Tag ) ;
                      Print("Panel = " + x.PanelIndex ) ;

                      but would need to get the Color and the Bars Ago
                      pmaglio
                      NinjaTrader Ecosystem Vendor - The Indicator Store

                      Comment


                        #12
                        Hello pmaglio, and thank you for your question.

                        You may use the nested ChartAnchors to retrieve BarsAgo information. These are documented here, I recommend using the 0th member.

                        http://ninjatrader.com/support/helpG...rawingtool.htm

                        For brushes, I would like to recommend using a C# dictionary to map the IDrawingObject's Tag member, which uniquely identifies the drawing object, to the Brush you used to draw it, at the time you create the object. For example,

                        Code:
                         private system.collections.generic.Dictionary<string, Brush> myMap;
                        Code:
                        else if (State == State.Configure)
                        {
                            myMap = new system.collections.generic.Dictionary<string, Brush>();
                        }
                        Code:
                        
                        Diamond myDiamond = Draw.Diamond(this, "tag1", true, 0, Low[0] - TickSize, Brushes.Red);
                        myMap[myDiamond.Tag] = Brushes.Red;
                        Jessica P.NinjaTrader Customer Service

                        Comment


                          #13
                          Just one more question....
                          If my code is not the one painting the object,
                          so Im just detecting them as it used to be on Ninja 7 with ChartControl.ChartObjects.InsertComplete or now on Ninja 8 with private void myCollectionChanged() as explained by Matthew

                          Now I have the new detected object on x;
                          IDrawingTool x = e.NewItems[0] as IDrawingTool;

                          Is it correct to do this ?
                          foreach (ChartAnchor anchor in x.Anchors)
                          {
                          Print("Bars Ago = "+ anchor.BarsAgo);
                          }

                          ... because I am not getting a valid result
                          ( I was expecting to get 0 for objects painted on current bar ... 1 for previous bars and so on... but I only get a big fixed integer number )
                          pmaglio
                          NinjaTrader Ecosystem Vendor - The Indicator Store

                          Comment


                            #14
                            Thanks once again for your question, and for using NinjaTrader 8

                            I am investigating this on our end and reviewing the expected operation of NinjaTrader. I appreciate your patience with this process. Should this not be the expected operation of Ninja I will return with a bug tracking number.

                            Should this be a NinjaTrader bug, a stripped down code sample from you highlighting what is occurring would be greatly appreciated.
                            Jessica P.NinjaTrader Customer Service

                            Comment


                              #15
                              Hello pmaglio,

                              I do not believe we will be able to use either the NewItems or the OldItems List. When I use the attached code, both NewItems and OldItems are always null. I believe on your system you may be retrieving uninitialized objects.

                              In case I may have misunderstood or coded something improperly, would it be possible for you to modify the sample I have attached so that it reproduces the conditions you are observing?
                              Attached Files
                              Jessica P.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by fawzanalim, Today, 04:37 AM
                              0 responses
                              8 views
                              0 likes
                              Last Post fawzanalim  
                              Started by soon123, Today, 02:14 AM
                              0 responses
                              8 views
                              0 likes
                              Last Post soon123
                              by soon123
                               
                              Started by guilhem, Today, 01:53 AM
                              1 response
                              8 views
                              0 likes
                              Last Post sgkcfc
                              by sgkcfc
                               
                              Started by elkingonzalez, 11-24-2020, 09:59 AM
                              4 responses
                              42 views
                              0 likes
                              Last Post MrSmart
                              by MrSmart
                               
                              Started by Photon66, Today, 12:03 AM
                              0 responses
                              12 views
                              0 likes
                              Last Post Photon66  
                              Working...
                              X