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

historical mode processing

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

    historical mode processing

    Hello, i just want to run this by you to review in case there is something else i need to do.

    I have a primary data series with my custom bar type built from ticks.
    This works perfectly and opens and closes as it should.

    In the indicator i add a 1 tick data series :

    AddDataSeries(BarsPeriodType.Tick, 1); in the configure section of OnStateChange...


    In OnBarUpdate i am collecting the 1 tick information and storing it against the primary bars after some of my checks and calculations on the 1 tick data.

    It seems when i load the chart and is in Historical state .... in order to align the 1 tick data referenced in BarsInProgress == 1 via the Closes[1][0] etc .... that
    in Historical mode i need to include it at CurrentBars[0] + 1

    then once RealTime kicks in it is CurrentBars[0]

    if i dont do CurrentBars[0] +1 for Historical the information doesnt line up with the open/close/high/low of the primary bar. if i do it aligns correctly.

    However i am wondering if i additionally need to make timestamp checks or other checks to sync the 2 series?

    Or is this expected when in historical mode processing and loading a chart?

    thanks

    #2
    Hi soulfx,

    I'm looking into this for you.

    I appreciate your patience while I do some testing.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi soulfx,

      I wanted to let you know I'm still looking into this with development.

      Currently, I have a demonstration script that is able to build a custom data series using tick data and get the same values as the primary series (indicating the order of operations is correct).

      However, what I am finding is that when OnBarUpdate is run for the primary series, this caches the values for all series synced with the primary. The cached data is what is used for indicators.

      The issue arises when we need to determine the primary has closed, then set the value for the custom series after the primary has closed. The series will contain the correct data, but the cached series (cached only when the primary bar closes) does not. Meaning, any indicators called, will get a 0 value for that bar (even though you can print your series and see its dead on).

      I'm working with development to find a solution, or to submit a feature request / bug report.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Thanks chelsea i appreciate the update:
        Indeed ....
        The issue arises when we need to determine the primary has closed, then set the value for the custom series after the primary has closed
        .... as you say .... good to know that there is a cache situation that can/does change things.

        So i use CurrentBars[0] to track when the primary closes and also in BarsInProgress == 0 .... i was checking for if is the first Historical bar with my own boolean to try to align the data.


        My One Tick series and the data/calculations I perform i am storing in a dictionary i maintain not a series. So with the very first Chart bar being 0 i know my dictionary key is 1 for the first bar. So am aware of the alignment. But in trying to determine the best way to process the AddDataSeries for a 1 tick this is what raises these questions.


        Not sure i fully follow what your are saying without seeing a code snippet but i get the gist of it

        thanks

        Comment


          #5
          Hi soulfx,

          So this did result in a bug report #NTEIGHT-11966.

          Attached is an example of building a custom bar series using individual ticks from tick data.

          With 8.0.8.0 this will not function in real-time but works in historical.

          Once (if) NTEIGHT-11966 has been corrected in a future release of NinjaTrader, this indicator should also function correctly in real-time.

          (Please wait for 11966 to appear in the release notes and then test the script provided in this post.
          http://ninjatrader.com/support/helpG...ease_notes.htm)
          Attached Files
          Chelsea B.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by traderqz, Today, 09:44 AM
          2 responses
          4 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by stafe, 04-15-2024, 08:34 PM
          8 responses
          40 views
          0 likes
          Last Post stafe
          by stafe
           
          Started by rocketman7, Today, 09:41 AM
          2 responses
          6 views
          0 likes
          Last Post rocketman7  
          Started by rocketman7, Today, 02:12 AM
          7 responses
          31 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by guillembm, Yesterday, 11:25 AM
          3 responses
          16 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X