Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.



    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:
        [FONT=Courier New]using System.Windows.Forms;[/FONT]
        [FONT=Courier New]using System.Collections;[/FONT]
        [FONT=Courier New] [/FONT]
        [FONT=Courier New] [/FONT]
        [FONT=Courier New]protected override void OnStartUp ( )[/FONT]
        [FONT=Courier New]{[/FONT]
        [FONT=Courier New]    Form cc = (Form)null;[/FONT]
        [FONT=Courier New]    if (cc == null)[/FONT]
        [FONT=Courier New]    {[/FONT]
        [FONT=Courier New]        foreach (Form form in (ReadOnlyCollectionBase)Application.OpenForms)[/FONT]
        [FONT=Courier New]        {[/FONT]
        [FONT=Courier New]            Print(form.GetType().FullName);[/FONT]
        [FONT=Courier New]            if (form.GetType().FullName == "NinjaTrader.Gui.ControlCenterForm")[/FONT]
        [FONT=Courier New]            {[/FONT]
        [FONT=Courier New]                cc = form;[/FONT]
        [FONT=Courier New]            }[/FONT]
        [FONT=Courier New]        }[/FONT]
        [FONT=Courier New]    }[/FONT]
        [FONT=Courier New]}[/FONT]
        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


                        #12
                        Originally posted by JerryWar View Post
                        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.
                        I want THIS!! Has it been accomplished? This would be a wonderful feature!! JerryWar Did you get it to work?

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by algospoke, Yesterday, 06:40 PM
                        2 responses
                        23 views
                        0 likes
                        Last Post algospoke  
                        Started by ghoul, Today, 06:02 PM
                        3 responses
                        14 views
                        0 likes
                        Last Post NinjaTrader_Manfred  
                        Started by jeronymite, 04-12-2024, 04:26 PM
                        3 responses
                        45 views
                        0 likes
                        Last Post jeronymite  
                        Started by Barry Milan, Yesterday, 10:35 PM
                        7 responses
                        22 views
                        0 likes
                        Last Post NinjaTrader_Manfred  
                        Started by AttiM, 02-14-2024, 05:20 PM
                        10 responses
                        181 views
                        0 likes
                        Last Post jeronymite  
                        Working...
                        X