• 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

MessageBox on associated chart NT7

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

    MessageBox on associated chart NT7

    Hi,
    I use a commercial product called Total Alert which displays a window box on the chart where an alert is triggered.
    I want to reproduce said behavior when a specific condition occurs. By using the following method:
    MessageBox.Show(DateTime.Now.ToString() + "EMA cross" + Time[0] + "," + Close[0] + "," + Instrument.FullName , "Alert" , MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
    I get the popup window. However, said window shows up on the chart which is currently active (owner of the message box is by default the currently active window).



    In the Internet, I´ve seen that the "parent windows" should be somehow referenced within said MessageBox instruction but I don´t know how.

    source : https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx

    #2
    Hello,

    Thank you for the post.

    You could try referencing the ChartControls parent control and casting it to the IWin32Window:

    Code:
    MessageBox.Show((IWin32Window )ChartControl.Parent, DateTime.Now.ToString() + "EMA cross" + Time[0] + "," + Close[0] + "," + Instrument.FullName , "Alert" , MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
    In my test I see this appearing on the chart where the alert was created, could you test this and make sure this works for your use case? Please note this is not going to center the box in the parent, but only display it above the parent in the same window somewhere. To center the box would be outside of what I could assist with, there are samples online you can see the required syntax for if you search for "winforms center messagebox in parent".


    I look forward to being of further assistance.
    Last edited by NinjaTrader_Jesse; 07-20-2018, 07:56 AM.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi,
      no compiling errors but it does nothing different to my code. Apparently the parent window is the window currently activated.

      The code must somehow reference the "real" parent window.

      I use the TidyTabs application to get tabbed windows, NT8 style but in NT7, so that when the alert is triggered, it should display the window associated to the alert, as the Total Alert indicator does.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by weav74, Today, 07:36 AM
      0 responses
      1 view
      0 likes
      Last Post weav74
      by weav74
       
      Started by billythekid72, Today, 07:10 AM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by Gav_G, 05-28-2020, 01:23 PM
      3 responses
      19 views
      0 likes
      Last Post NinjaTrader_Jim  
      Started by JustinOfNazareth, Today, 07:22 AM
      0 responses
      2 views
      0 likes
      Last Post JustinOfNazareth  
      Started by Josey, Today, 07:17 AM
      0 responses
      20 views
      0 likes
      Last Post Josey
      by Josey
       
      Working...
      X