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

Print doesn't print every time...

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

    Print doesn't print every time...

    I have a print command in my strategy that prints CurrentBar as the first command in OnBarUpdate, and I have some other print commands scattered through the strategy to try to solve a problem I'm wrestling with. Yet, when I run a backtest, the first printed string is CurrentBar = 12238. From then on it works fine. As the test is running it appears as though everything is being written to the Output window, as the scroll thumb gets smaller and smaller, but as soon as the test finishes, the thumb goes bigger again.

    I also have a print command in front of every enterlong and entershort in the strategy. According to the trade list the backtest has done 89 trades, and I can see them on the chart. However those print commands only produce 8 line in the Output window.

    I don't get it. How come I only see the last 10% of my print output. Is there a size limit on the Output window or something?

    Thanks,
    Ian

    #2
    Is the output window filling beyond capacity?

    I believe there is a limit before it starts to dump output.

    It sounds like you are dumping a lot of data?

    Have you printed time stamps to verify where you are?

    I don't think the output window holds hours and hours of data...there is no chance of that.





    Originally posted by Owlman View Post
    I have a print command in my strategy that prints CurrentBar as the first command in OnBarUpdate, and I have some other print commands scattered through the strategy to try to solve a problem I'm wrestling with. Yet, when I run a backtest, the first printed string is CurrentBar = 12238. From then on it works fine. As the test is running it appears as though everything is being written to the Output window, as the scroll thumb gets smaller and smaller, but as soon as the test finishes, the thumb goes bigger again.

    I also have a print command in front of every enterlong and entershort in the strategy. According to the trade list the backtest has done 89 trades, and I can see them on the chart. However those print commands only produce 8 line in the Output window.

    I don't get it. How come I only see the last 10% of my print output. Is there a size limit on the Output window or something?

    Thanks,
    Ian

    Comment


      #3
      Maybe, maybe not...

      That was my first thought. But I've dumped a lot of data to the output window before (especially before I discovered the ClearOutputWindow command) and it's never been a problem. Now even a backtest on one day's data causes the problem. It's only 16 trades, and a couple of lines printed for each trade. But I only see four lines of output.

      Comment


        #4
        Are there any errors in the log tab as this happens? Have you tried the same simple test after a clean reboot / restart? There's a output window limit, but you're not near the limits here definitely...
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Solved, sort of...

          Hi Bertrand,

          No nothing like that, but I've solved it. I had ClearOutputWindow at the start of the strategy. I've had this problem before but forgotten about it. If I remove that, everything works fine, but for some reason having that command seems to randomly delete stuff. I've even run the exact same backtest twice in a row and had two different sets of data in the Output window. But once I removed the ClearOutputWindow command it works fine.

          The only problem now, of course, is that I have to remember to clear the output window before each test!

          Thanks,
          Ian

          Comment


            #6
            Originally posted by Owlman View Post
            Hi Bertrand,



            The only problem now, of course, is that I have to remember to clear the output window before each test!

            Thanks,
            Ian
            The output window in the latest nt7 release appears to keep the position of the newest output.

            Can you move the command to Initialize?

            You might have to restart the strategy??

            Comment


              #7
              Thanks Bertrand,

              That's correct, output appears to be appended at the end of the existing file (rather than replacing it), and the latest data is shown by default (if you don't use ClearOutputWindow).

              It's always been in Initialize. And I don't use it when running in real time, only in strategy analyser.

              Cheers, Ian

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by haas88, 03-21-2024, 02:22 AM
              18 responses
              208 views
              0 likes
              Last Post haas88
              by haas88
               
              Started by Board game geek, Today, 02:20 AM
              0 responses
              2 views
              0 likes
              Last Post Board game geek  
              Started by knighty6508, Today, 01:20 AM
              2 responses
              14 views
              0 likes
              Last Post knighty6508  
              Started by franatas, Today, 01:53 AM
              0 responses
              3 views
              0 likes
              Last Post franatas  
              Started by knighty6508, Today, 01:17 AM
              0 responses
              9 views
              0 likes
              Last Post knighty6508  
              Working...
              X