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

Flush Print buffer

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

    Flush Print buffer

    After starting a strategy, NT buffers output from the Print command until the last historical bar has been processed and real-time begins before writing the buffered output to the Output window.

    How does one flush the Print buffer on demand so that at any time from starting a strategy (even during historical processing), the output from the Print command can be flushed to the Output window?

    Thanks!
    Multi-Dimensional Managed Trading
    jeronymite
    NinjaTrader Ecosystem Vendor - Mizpah Software

    #2
    Hello jeronymite,
    You can use the ClearOutputWindow to clear the output window. Please refer to our help guide to know more.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Thanks, Joydeep. That is not what I want to do, however.

      I need the accumulated buffered output to appear in the Output window on demand, rather than wait until NT decides to show it.

      Like this: Print.Flush() to show all currently buffered output in the Output window.

      Thanks.
      Multi-Dimensional Managed Trading
      jeronymite
      NinjaTrader Ecosystem Vendor - Mizpah Software

      Comment


        #4
        Hello jeronymite,
        Thanks for the clarification.

        Unfortunately there are no native way to do it. You can however custom code further and achieve it using C# codes.

        For example you could collect all the messages in a list of strings and then choose to "flush" it in the Output Window

        Code:
        //in variable 
        List<string> list = new List<string>();
        
        //in OnBarUpdate
        
        //add the custom messages in the list
        if (condition)
        list.Add("my message");
        
        //flush it to the output window
        if (condition)
        {
                foreach (string str in list)
        	{
        		Print(str);
        	}
        }
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          Thanks, Joydeep.

          That will not work either, I'm sorry. I use the Print command directly in my script, so there is no need to create lists of strings to Print later as that only complicates the matter.

          The Print command sends output to a buffer that is eventually written to the Output window. When starting a strategy, historical bars are processed and then real-time bars. It is during the processing of the historical bars that NT buffers all the Print'ed output until the real-time bars are reached, at which point, NT flushes the buffer and the output appears in the Output window. None of the output during that historical processing is visible until the real-time bars are reached and the Print buffer is flushed.

          I want to be able to flush the buffered Print'ed output on demand so that it appears in the Output window during this historical bar processing and before the real-time bars are reached.

          Essentially, what is the C# code that says "flush what is currently in the Print buffer to the Output window now"?

          Thanks again for your assistance.
          Multi-Dimensional Managed Trading
          jeronymite
          NinjaTrader Ecosystem Vendor - Mizpah Software

          Comment


            #6
            Hello jeronymite,
            Unfortunately it is not possible to do so.

            You may create your own form / Output window using C# codes, however nothing we could support.
            JoydeepNinjaTrader Customer Service

            Comment


              #7
              OK. Thanks, Joydeep.

              May I request that this be added to a future release of NT so that it is possible to do this, please?

              Thanks!
              Multi-Dimensional Managed Trading
              jeronymite
              NinjaTrader Ecosystem Vendor - Mizpah Software

              Comment


                #8
                Hello jeronymite,
                Thanks for your feedback.

                I will forward your feature request to development for future consideration.
                JoydeepNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by andrewtrades, Today, 04:57 PM
                1 response
                5 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by chbruno, Today, 04:10 PM
                0 responses
                3 views
                0 likes
                Last Post chbruno
                by chbruno
                 
                Started by josh18955, 03-25-2023, 11:16 AM
                6 responses
                436 views
                0 likes
                Last Post Delerium  
                Started by FAQtrader, Today, 03:35 PM
                0 responses
                6 views
                0 likes
                Last Post FAQtrader  
                Started by rocketman7, Today, 09:41 AM
                5 responses
                19 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Working...
                X