Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exporting RTH or Local Time Data

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

    Exporting RTH or Local Time Data

    Is there any way of exporting RTH data only for a given ticker?

    Or, failing that, any way of exporting data with its original exchange timestamps, as opposed to UTC as is currently the case?

    Or, failing that, is there any way of programatically pulling the actual trading days (or conversely non-trading days) for a given ticker?

    thanks

    #2
    Hello trader_rick, thanks for your post.

    Exported data will always output the full data set in UTC time. If you need a portion of this data, an application external to NInjaTrader would need to do the work to manipulate the exported data into the desired format. A programmatic way of exporting data could be done with a custom indicator. Indicators iterate through all bars on a chart when they are started, so the indicator can write the price data and timestamp data to a .txt file. When running the RTH session template on the chart, only the RTH prices and timestamps will be written. We have a related example here that demonstrates file IO from an indicator:

    https://ninjatrader.com/support/help...o_write_to.htm
    https://ninjatrader.com/support/help..._propertie.htm

    Please let me know if I can assist any further.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      OK - thanks Chris, I'll take a look at the I/O option.

      Comment


        #4
        Sample stream writer worked beautifully, thanks!

        Comment


          #5
          There is a problem - the very last bar is not written to file. I don't understand this as the write procedure is called OnBarUpdate() with
          Code:
          Calculate = Calculate.OnBarClose
          .

          Somehow the bar close event isn't triggered for the last bar. Is there a way of forcing NT to recognize this last bar?

          EDIT:
          I repeated the call to my write code using State.Transition, which is supposed to be called when processing of historical data terminates. This only succeeds in duplicating writing of the penultimate bar, which suggests that somehow the last bar is not being pulled in. And yet, I can clearly see the last bar on the chart from which the indicator is called.

          regards
          Last edited by trader_rick; 02-18-2021, 06:46 AM.

          Comment


            #6
            Hello trader_rick, thanks for your reply.

            If you need to capture the currently forming bar, you would need to run the script OnEachTick, then write all data when IsFirstTickOfBar == true. e.g.

            OnBarUpdate()
            {
            if(IsFirstTickOfBar)
            {
            //Run code once at the first tick of the bar.
            }
            }

            To get the very first tick of the session (not the first real time tick) you will also need to enable Tick Replay in Tools>Options, then enable Tick Replay in the data series menu of the chart for 100% tick accuracy.

            Please let me know if I can assist any further.
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              Hi Chris,

              That appears to have done the trick! (I'd tried Calculate.OnEachTick but hadn't checked for the first tick of the bar.)

              Thanks for you help

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Lumbeezl, 01-11-2022, 06:50 PM
              31 responses
              817 views
              1 like
              Last Post NinjaTrader_Adrian  
              Started by xiinteractive, 04-09-2024, 08:08 AM
              5 responses
              14 views
              0 likes
              Last Post NinjaTrader_Erick  
              Started by swestendorf, Today, 11:14 AM
              2 responses
              6 views
              0 likes
              Last Post NinjaTrader_Kimberly  
              Started by Mupulen, Today, 11:26 AM
              0 responses
              7 views
              0 likes
              Last Post Mupulen
              by Mupulen
               
              Started by Sparkyboy, Today, 10:57 AM
              1 response
              7 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Working...
              X