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

ClearOutputWindow() in backtest

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

    ClearOutputWindow() in backtest

    Hello,

    am i see correctly if i use ClearOutputWindow() method in OnBarUpdate() /see below/, then that will not run in backtest mode?


    protectedoverridevoid OnBarUpdate()
    {
    Print(
    "OnBarUpdate");
    ClearOutputWindow();
    ...

    }

    thanks in advance,

    #2
    Not sure what you mean. Using ClearOutputWindow() clears the window whenever your code reaches it. Your current code means clear it every time you update your bars. Bars do update in backtests. That is how your strategy can process the historical bars.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Josh View Post
      Not sure what you mean. ...
      Sorry, probably i was misunderstandable ...

      If i use sample in strategy at simulation mode and when OnBarUpdate method is called, then text "OnBarUpdate" will be written to the outputwindow and after this the window will be clear.

      If i use sample in strategy at backtest and when OnBarUpdate method is called, then text will be written to the outputwindow and after this the window will not be clear. The result after the backtest in window:
      OnBarUpdate
      OnBarUpdate
      OnBarUpdate
      OnBarUpdate
      etc.

      So the question: am i see correctly that ClearOutputWindow() method will not run in backtest mode?

      Comment


        #4
        tamas, I ran a few quick tests and I believe that ClearOutputWindow(), when called from a backtest, will only clear the Print()s from the current backtest.

        Reasoning:
        I created a strategy that printed two lines of text on bar 100.
        I ran the test once, and the two lines of text popped up, as expected.
        Then, I added a ClearOutputWindow() line to follow the two print statements and ran the test again. Nothing appeared in the output window, but the two first lines still remained.
        Then I deleted the clear line and ran it again, and two more lines popped up.
        Then I added the clear line again and ran it, but there were still four lines of text after the test ran again.
        AustinNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Austin View Post
          tamas, I ran a few quick tests and I believe that ClearOutputWindow(), when called from a backtest, will only clear the Print()s from the current backtest.

          Reasoning:
          ...
          Hello Austin,

          thanks the detailed answer! I think, what you wrote would work if your code is in Initialize() method and not in OnBarUpdate() method. To be more ubderstandable i attached sample and scrrenshot about the result. From this reason i think that ClearOutputWindow() method in OnBarUpdate() will not run strategy during backtest. Is this true?

          (This could be a logical solution, because all printing values (in backtest mode) will be seen after run. So i only would like to get confirmation about this.)

          Thank you,
          Attached Files

          Comment


            #6
            Tamas, from our independent tests, I would say that it is clear that ClearOutputWindow() inside OnBarUpdate() does not fire during a backtest.
            AustinNinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Austin View Post
              Tamas, from our independent tests, I would say that it is clear that ClearOutputWindow() inside OnBarUpdate() does not fire during a backtest.
              Thank you Austin,

              Happy Holidays for you and the support team.

              Comment


                #8
                No problem, Tamas. Enjoy your holidays as well.
                AustinNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by StrongLikeBull, Yesterday, 04:05 PM
                1 response
                12 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by Mestor, 03-10-2023, 01:50 AM
                14 responses
                375 views
                0 likes
                Last Post z.franck  
                Started by molecool, 10-09-2017, 10:48 AM
                5 responses
                1,621 views
                0 likes
                Last Post trader-ap  
                Started by The_Sec, Yesterday, 03:53 PM
                1 response
                12 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by mmenigma, Yesterday, 03:25 PM
                1 response
                11 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Working...
                X