NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 02-18-2011, 07:50 PM   #1
Owlman
Member
 
Join Date: Jun 2008
Location: Sydney
Posts: 53
Thanks: 2
Thanked 0 times in 0 posts
Default 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
Owlman is offline  
Reply With Quote
Old 02-18-2011, 11:13 PM   #2
sledge
Senior Member
 
Join Date: Aug 2010
Location: Washington, D.C.
Posts: 1,267
Thanks: 192
Thanked 332 times in 287 posts
Default

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.





Quote:
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
sledge is offline  
Reply With Quote
Old 02-19-2011, 12:01 AM   #3
Owlman
Member
 
Join Date: Jun 2008
Location: Sydney
Posts: 53
Thanks: 2
Thanked 0 times in 0 posts
Default 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.
Owlman is offline  
Reply With Quote
Old 02-19-2011, 12:38 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,013 times in 994 posts
Default

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...
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 02-19-2011, 12:43 AM   #5
Owlman
Member
 
Join Date: Jun 2008
Location: Sydney
Posts: 53
Thanks: 2
Thanked 0 times in 0 posts
Default 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
Owlman is offline  
Reply With Quote
Old 02-19-2011, 10:53 PM   #6
sledge
Senior Member
 
Join Date: Aug 2010
Location: Washington, D.C.
Posts: 1,267
Thanks: 192
Thanked 332 times in 287 posts
Default

Quote:
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??
sledge is offline  
Reply With Quote
Old 02-23-2011, 12:59 AM   #7
Owlman
Member
 
Join Date: Jun 2008
Location: Sydney
Posts: 53
Thanks: 2
Thanked 0 times in 0 posts
Default

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
Owlman is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Print doesn't print when CurrentBar ==0 Lost Trader General Programming 3 08-13-2010 10:03 AM
Need help print past bar time saroj General Programming 2 10-11-2009 12:11 PM
Print() duck_CA Strategy Development 2 03-07-2009 01:18 PM
Print the charts with long time series randomcz Charting 1 02-24-2009 04:22 AM
Synchronization problem in multi-time strats OR multithreading affecting Print()? qbit9 Strategy Development 5 10-03-2007 03:02 PM


All times are GMT -6. The time now is 06:59 PM.