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

Get x,y position of current window

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

    Get x,y position of current window

    Hi,
    Is there a way to get the x, y (in windows terms, the top, left) position of the chart window in which I have added an indicator, within the indicator code?
    Thank-you,
    iq

    #2
    Hello iq200,

    Are you referring to the actual window position or are you referring to the X/Y inside of the chart panel that your indicator can render to?

    You can get either however those are different concepts.

    The ChartPanel object exposes the charts sizes: https://ninjatrader.com/support/help...chartpanel.htm
    You can see the SampleCustomRender indicator for examples of rendering to the corners of the chart.

    If you otherwise meant the window you can access its WPF window properties like the following:

    Code:
    ChartControl.Dispatcher.InvokeAsync((Action)(() =>
    {
    
                    //Obtain the Chart on which the indicator is configured
                    chartWindow = Window.GetWindow(this.ChartControl.Parent) as Chart;
                    chartWindow.Top
                    chartWindow.Left
    });
    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      HI Jesse,
      I was referring to the actual window (which contains the chart) position on the screen.
      The reason I'm asking is that I'm creating an external window and I need to arrange this window alongside the chart window.
      Right now, the external window gets created based on a location determined by Windows.
      It looks like the snippet you posted should do the job.
      Thank-you for your help.
      Regards,
      iq

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by dcriador, Today, 12:06 PM
      0 responses
      6 views
      0 likes
      Last Post dcriador  
      Started by dcriador, Today, 12:04 PM
      0 responses
      4 views
      0 likes
      Last Post dcriador  
      Started by cutzpr, Today, 08:54 AM
      0 responses
      10 views
      0 likes
      Last Post cutzpr
      by cutzpr
       
      Started by benmarkal, Today, 08:44 AM
      0 responses
      16 views
      0 likes
      Last Post benmarkal  
      Started by Tin34, Today, 03:30 AM
      2 responses
      28 views
      0 likes
      Last Post Tin34
      by Tin34
       
      Working...
      X