![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Sunday May 26th at 12PM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Jul 2011
Posts: 8
Thanks: 1
Thanked 0 times in 0 posts
|
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. |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,794
Thanks: 160
Thanked 568 times in 559 posts
|
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?
Matthew
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Jul 2011
Posts: 8
Thanks: 1
Thanked 0 times in 0 posts
|
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. |
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Jul 2011
Posts: 8
Thanks: 1
Thanked 0 times in 0 posts
|
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.
|
|
|
|
|
|
#5 |
|
NinjaTrader Customer Service
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,794
Thanks: 160
Thanked 568 times in 559 posts
|
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.
Matthew
NinjaTrader Customer Service |
|
|
|
![]() |
| Tags |
| afterhours, onbarupdate, streamwriter |
| Thread Tools | |
| Display Modes | |
|
|
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 |