• 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

Current Cursor Y Position on Chart Displayed on Dom

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

    Current Cursor Y Position on Chart Displayed on Dom

    Is it possible for a routine, Added to the SuperDom Columns to Read the Global Cursor position? I want to write some code to read the Cursor price and hi-lite the price Cell on the Dom or if the Dom can't be directly Modified, Color an Adjacent added column Cell.
    The idea is to give a direct indication on the Dom of where to place Stops, Targets Entries etc. without going thru a translation process of first determining what the price was on the chart and then finding that price on the Dom.

    I figured I would ask before attempting this since I would have a learning curve in writing Code for the Dom.

    #2
    While fully developing this solution is beyond the scope of the support we may provide, I can help get you started. Attached is a code sample which will give you a launch point which will run a method on a SuperDOM's thread with a reference to the SuperDOM window once a second (or more often if you prefer).

    Once you have this add on loaded, you can search within the e.Window object for Automation IDs of various top level components, to see if they are selected. My colleague Jesse's post here will be of value in discovering these IDs.

    http://ninjatrader.com/support/forum...44&postcount=7

    The above process will also reveal an object's class. You can search MSDN's C# and WPF documentation for this class' name to find out how to either search pixel coordinates within the object, or to see if it is in a selected state or not.

    Please let us know if there are any other ways we can help.
    Attached Files
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Jessica
      I am running win 7 but Net 4.5 The SDK for Win 7 seems to only go to Net 4.0 in which case even tho I am running Win 7 do I download Win 8 Net 4.5 ?

      Thanks

      Comment


        #4
        I have requested that this be moved from the NT8 to the NT7 forums. That said, while NT8 has a robust add-on framework in place, NT7 is no longer under active development, and there is very limited support for accessing windows in NT7.

        I will leave this post open in case any member of the community would like to help.

        As a starting point, this code allows you to loop through the open form windows in NinjaTrader and get a specific form.

        Code:
        using System.Windows.Forms;
        using System.Collections;
        
        
        protected override void OnStartUp ( )
        {
            Form cc = (Form)null;
            if (cc == null)
            {
                foreach (Form form in (ReadOnlyCollectionBase)Application.OpenForms)
                {
                    Print(form.GetType().FullName);
                    if (form.GetType().FullName == "NinjaTrader.Gui.ControlCenterForm")
                    {
                        cc = form;
                    }
                }
            }
        }
        Jessica P.NinjaTrader Customer Service

        Comment


          #5
          Jessica,
          I am confused, I am running NT 8.0.4 under Windows 7. Why does this belong in the NT7 forum ?
          but to the point of the code you posted. Am I assuming this code is a shortcut to finding the Window Name so I can get the cursor from the Chart form name rather than running inspect.exe

          Is this correct ?

          Thanks

          Comment


            #6
            I apologize, I read your post incorrectly and thought you were mentioning NinjaTrader 7 and not Windows 7.

            The code I provided is code which gives you a searchable Window object for WPF. With this object you can use AutomationIDs to access any WPF element inside the element.

            The link enables you to learn AutomationIDs for any WPF element you can see visually, while Ninja is running.
            Jessica P.NinjaTrader Customer Service

            Comment


              #7
              Is the Code snippet you posted NT7 because I could not get it to compile.

              Comment


                #8
                The second code sample is NT7 and can be ignored. The (re)attached code sample is an NT8 add-on. If this does not compile please let us know what messages you are receiving so we can look further into this.
                Attached Files
                Jessica P.NinjaTrader Customer Service

                Comment


                  #9
                  I was referring to the Second code sample to Find the form name.
                  Again I am assuming I must have the form and then acquire the cursor
                  handle in order to get the current cursor location. I am a little unsure of which command to use
                  given I just want to read the location on the fly not read the location of the last mouse click or anchor.

                  Comment


                    #10
                    The second code sample was included by mistake, when I misread something you said. I thought this was a NinjaTrader 7 file. Please ignore the second code sample. NinjaTrader 8 is not a winforms application, but is rather a wpf application.

                    The instructions in the first post are the only valid instructions. If these could use clarification or you can't see the same thing we're describing in that post on your end, please let us know so we may assist further.
                    Jessica P.NinjaTrader Customer Service

                    Comment


                      #11
                      Jessica, Thank you , That clarifies it.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Vincere, Yesterday, 11:20 PM
                      0 responses
                      3 views
                      0 likes
                      Last Post Vincere
                      by Vincere
                       
                      Started by lMagi, 05-18-2019, 09:34 AM
                      1 response
                      4 views
                      0 likes
                      Last Post NinjaTrader_ChrisSch  
                      Started by uday12, Yesterday, 10:26 PM
                      0 responses
                      2 views
                      0 likes
                      Last Post uday12
                      by uday12
                       
                      Started by uday12, Yesterday, 10:07 PM
                      0 responses
                      0 views
                      0 likes
                      Last Post uday12
                      by uday12
                       
                      Started by Nabil, Yesterday, 07:46 PM
                      1 response
                      5 views
                      0 likes
                      Last Post NinjaTrader_ChelseaB  
                      Working...
                      X