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.

    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 sjsj2732, Yesterday, 04:31 AM
      0 responses
      30 views
      0 likes
      Last Post sjsj2732  
      Started by NullPointStrategies, 03-13-2026, 05:17 AM
      0 responses
      286 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      282 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      132 views
      1 like
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      90 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Working...
      X