Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Suppress NinjaTrader Messages

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

    Suppress NinjaTrader Messages

    I have automated strategies running, but at times I get messages that orders were rejected for various reasons. I have internal logic to handle all of those cases, but the messages still populated and it can be quite annoying.

    Is it possible to suppress those messages?

    Thanks for any help

    #2
    Hello Lumbeezl,

    Thanks for your post.

    There are no supported ways to suppress error messages or pop-up messages, such as rejected order messages, in NinjaTrader.

    We are currently tracking interest to suppress these messages in an internal ticket. I have added your vote to this feature request. The internal tracking number for your feature request is SFT-3030. Please reference this internal tracking number when contacting Platform Support if you ever have questions regarding this feature request.

    When a feature request is implemented, you'll find a description of the new feature in the release notes:Let us know if we may further assist.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Please add my vote to this request.

      Thank you

      Comment


        #4
        Hello geekodude,

        Thanks for your note.

        Your vote has been added to SFT-3030.

        Let us know if we may assist further.
        Brandon H.NinjaTrader Customer Service

        Comment


          #5
          Since NT8 is written in WPF, I should be able to access the windows created by NT8.

          The following code doesn't work because it's running on a different thread than the UI thread. I'm not as familiar with C# as C++ so I'm unsure how to access that thread. Any guidance on that would be appreciated.

          Code:
          foreach (Window window in Application.Current.Windows)
          {
               if (window.Title.Contains("Error"))
               {
                    window.Close();
               }
          }

          Comment


            #6
            After some testing and hitting Google, I was able to find a method that works. Here is the code for anyone interested:

            Code:
            protected void CloseErrorWindows()
            {
                if (!Dispatcher.CheckAccess())
                {
                    Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        foreach (Window window in Application.Current.Windows)
                        {
                            if (window.Title == "Error")
                            {
                                window.Close();
                            }
                        }
                    }));
                }
            }

            Comment


              #7
              Hi Lumbeezi - Thanks for posting this code here. Are you calling it from OnBarUpdate() at the start? I am also facing similar issue - sometimes the application hangs because of a large amount of error messages and then a reboot is required.

              Comment


                #8
                rajvarsh Yes, I am calling this in OnBarUpdate(). I wanted to try and run it only when after the order is rejected and the window populates. I think I'd have to have a timer in OnOrderUpdate() after the rejection occurs and wait until the window shows before it removes it, but I haven't actually tried or tested anything.

                Comment


                  #9
                  Lumbeezl .. I tested it and it works! I included it in the top line of OnBarUpdate() and added a return statement in the CloseErrorWindows(). I checked the log (control center window) it contains the errors but those pop-up errors are not appearing and the strategy continues to run without an interruption. Posting the modified code below for reference. Thanks again for your help!

                  protected override void OnBarUpdate()
                  {

                  CloseErrorWindows();

                  < Rest of the code>

                  }

                  protected void CloseErrorWindows()
                  {
                  if (!Dispatcher.CheckAccess())
                  {
                  Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                  {
                  foreach (Window window in Application.Current.Windows)
                  {
                  if (window.Title == "Error")
                  {
                  window.Close();
                  }
                  }
                  }));

                  return;
                  }
                  }

                  Comment


                    #10
                    Originally posted by Lumbeezl View Post
                    rajvarsh Yes, I am calling this in OnBarUpdate(). I wanted to try and run it only when after the order is rejected and the window populates. I think I'd have to have a timer in OnOrderUpdate() after the rejection occurs and wait until the window shows before it removes it, but I haven't actually tried or tested anything.
                    By no means am I recommending this!

                    As I'm not exactly sure just how many error message types this will effect..
                    (Meaning this likely will effect more than just an order rejection error!)

                    But it would be much more efficient to use an add-on script instead of indy/strat..
                    This way it auto loads on start-up and only runs when when a window is created..


                    Code:
                    namespace NinjaTrader.NinjaScript.AddOns
                    {
                        public class AutoCloseNTErrorWindow : NinjaTrader.NinjaScript.AddOnBase
                        {
                            protected override void OnStateChange()
                            {
                                if (State == State.SetDefaults)
                                {
                                    Description    = @"Auto Close NTMessage Box Error Windows (Not Recommended)";
                                    Name            = "AutoCloseNTErrorWindow";
                                }
                            }
                    
                            protected override void OnWindowCreated(Window window)
                            {
                                base.OnWindowCreated(window);
                                if(window != null && window.GetType().ToString().Equals("NinjaTrader.Gui.NTMessageBox") && window.Title.Contains("Error")) {window.Close(); }
                            }
                        }
                    }

                    Be Safe in this Crazy World!
                    -=Edge=-
                    NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

                    Comment


                      #11
                      -=Edge=- I'm not very familiar with WPF, and I also believe the NinjaScript documentation does leave you wanting, so I didn't know how to access when a window was created.

                      This is perfect. Thank you.

                      Comment


                        #12
                        Please add my vote for SFT-3030 as well. And note that this should be merged with SFT-671.

                        Comment


                          #13
                          Hello karenmkrohn,

                          Thanks for your post.

                          Your vote has been added to SFT-3030.

                          Let us know if we may assist further.​
                          Adrian B.NinjaTrader Customer Service

                          Comment


                            #14
                            +1

                            Please add my vote.

                            Comment


                              #15
                              Originally posted by -=Edge=- View Post
                              By no means am I recommending this!
                              It's too bad we can't use this approach to type in the password and click to sign in.
                              Bruce DeVault
                              QuantKey Trading Vendor Services
                              NinjaTrader Ecosystem Vendor - QuantKey

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by xiinteractive, 04-09-2024, 08:08 AM
                              2 responses
                              11 views
                              0 likes
                              Last Post xiinteractive  
                              Started by Irukandji, Today, 09:34 AM
                              1 response
                              3 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Started by RubenCazorla, Today, 09:07 AM
                              1 response
                              5 views
                              0 likes
                              Last Post RubenCazorla  
                              Started by TraderBCL, Today, 04:38 AM
                              3 responses
                              25 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by WeyldFalcon, 08-07-2020, 06:13 AM
                              11 responses
                              1,423 views
                              0 likes
                              Last Post jculp
                              by jculp
                               
                              Working...
                              X