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

4:00 P.M. + Streamwriter + OnBarUpdate = Stupid Question (?)

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

    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.

    #2
    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?
    MatthewNinjaTrader Product Management

    Comment


      #3
      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.

      Comment


        #4
        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.

        Comment


          #5
          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.
          MatthewNinjaTrader Product Management

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by traderqz, Today, 12:06 AM
          2 responses
          3 views
          0 likes
          Last Post traderqz  
          Started by RideMe, 04-07-2024, 04:54 PM
          5 responses
          28 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by f.saeidi, Today, 08:13 AM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by DavidHP, Today, 07:56 AM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by kujista, Today, 06:23 AM
          3 responses
          11 views
          0 likes
          Last Post kujista
          by kujista
           
          Working...
          X