NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


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

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 09-01-2011, 02:23 PM   #1
allman
Junior Member
 
Join Date: Jul 2011
Posts: 8
Thanks: 1
Thanked 0 times in 0 posts
Default 4:00 P.M. + Streamwriter + OnBarUpdate = Stupid Question (?)

Disclaimer: This is probably a very stupid question, but I'll ask anyway.


I'm using Streamwriter to dump data into a txt file, from inside an indicator script. This gets called inside OnBarUpdate(). Works great except at 4:00 P.M. which I suppose has to do with when a bar gets updated - I can live with that - don't need an explanation if that's just the way things are.


So my question is:

Is there another way to execute Streamwriter from somewhere else besides inside OnBarUpdate(), so that it gets executed at or after 4:00 P.M.? Like in a "Main()" or something? ( e.g. if (time.now = 160100) then (blah, blah, blah) )


Obviously, I'm not a C# or Ninjascript whiz, and I have a strong feeling the answer is something obvious or basic.

Thanks.
allman is offline  
Reply With Quote
Old 09-01-2011, 02:32 PM   #2
NinjaTrader_Matthew
NinjaTrader Customer Service
 
NinjaTrader_Matthew's Avatar
 
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,786
Thanks: 160
Thanked 567 times in 558 posts
Default

allman,

Thank you for your post.

What session template are you running the indicator on? Is the session template excluding bars after 4:00PM? Does it work to use the Default 24/7 session?
NinjaTrader_Matthew is offline  
Reply With Quote
Old 09-01-2011, 02:46 PM   #3
allman
Junior Member
 
Join Date: Jul 2011
Posts: 8
Thanks: 1
Thanked 0 times in 0 posts
Default

I'm using RTH. When I select "use instrument settings", that also comes back with RTH. Both of these do exclude bars after 4:00 P.M..

When I use ETH, it does work (i.e. Streamwriter generates the 4:00 bar). However this is not desired as it can causes TDA-error messages and it needs to be switched back (to RTH) in the morning to avoid inclusion of non-RTH bars on the chart.

In other words, I can induce Streamwriter to generate 4:00 data by using ETH, but I am hoping that there is a better (programatic) solution.
allman is offline  
Reply With Quote
Old 09-01-2011, 02:51 PM   #4
allman
Junior Member
 
Join Date: Jul 2011
Posts: 8
Thanks: 1
Thanked 0 times in 0 posts
Default

I just checked in the Control Center, under Sessions, and "Default 24/7" was the default. When I add a chart, I usually specify RTH for the Data Series.
allman is offline  
Reply With Quote
Old 09-01-2011, 02:51 PM   #5
NinjaTrader_Matthew
NinjaTrader Customer Service
 
NinjaTrader_Matthew's Avatar
 
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,786
Thanks: 160
Thanked 567 times in 558 posts
Default

allman,

Streamwriter is only going to work if you're receiving ticks. If you set this to RTH, there are no incoming ticks on the chart at this time.

It wouldn't be possible to collect data outside of the range of the session template.
NinjaTrader_Matthew is offline  
Reply With Quote
Reply

Tags
afterhours, onbarupdate, streamwriter

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
NT7 chart problem at 00:00 pnorbutas Version 7 Beta General Questions & Bug Reports 5 04-19-2010 09:14 AM
Tick Chart - Yesterday's Time Stamps all set to 00:00:00 mjc4118 Version 7 Beta General Questions & Bug Reports 2 12-23-2009 09:54 AM
Tracking crossing 24:00:00 marketmasher General Programming 1 06-10-2009 07:28 AM
Stupid Question - can a strategy recover when restarted after a crash? bridenour Automated Trading 10 03-02-2009 04:55 PM
Stupid Question hcoffin Strategy Development 1 08-07-2008 01:31 AM


All times are GMT -6. The time now is 08:38 AM.