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

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 bortz, 11-06-2023, 08:04 AM
      47 responses
      1,609 views
      0 likes
      Last Post aligator  
      Started by jaybedreamin, Today, 05:56 PM
      0 responses
      9 views
      0 likes
      Last Post jaybedreamin  
      Started by DJ888, 04-16-2024, 06:09 PM
      6 responses
      19 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by Jon17, Today, 04:33 PM
      0 responses
      6 views
      0 likes
      Last Post Jon17
      by Jon17
       
      Started by Javierw.ok, Today, 04:12 PM
      0 responses
      16 views
      0 likes
      Last Post Javierw.ok  
      Working...
      X