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 alifarahani, Today, 09:40 AM
      3 responses
      15 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by RookieTrader, Today, 09:37 AM
      4 responses
      17 views
      0 likes
      Last Post RookieTrader  
      Started by PaulMohn, Today, 12:36 PM
      0 responses
      4 views
      0 likes
      Last Post PaulMohn  
      Started by love2code2trade, 04-17-2024, 01:45 PM
      4 responses
      39 views
      0 likes
      Last Post love2code2trade  
      Started by junkone, Today, 11:37 AM
      3 responses
      23 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X