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

AddOn able to access tick replay data?

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

    AddOn able to access tick replay data?

    Hi there,

    I have an AddOn which gets OnMarketData() and OnMarketDepth() correctly from the point it launches. Unclear if/how can run the tick replay through this???

    My AddOn creates an Indicator which it sends the Market/Depth info to for processing. This works fine but would like to send all tick data to it on startup.

    The "TickReplayIndicator" I have seen mentioned and have tried to put that in the OnStateChange() handlers under State.DataLoaded to get something happening.

    Unfortunately I am unable to resolve where TickReplayIndicator is declared to include it so can't even compile. Any help?

    -Jim

    #2
    Hello JimB17,

    Thanks for writing in to our Support Forums!

    I believe you are referring to this section of the help guide on Developing for Tick Replay.

    Code:
    TickReplayIndicator myTickReplayIndicator = null;
     
    protected override void OnStateChange()
    {
      if (State == State.SetDefaults)
      {
          Name   = "TestHost";
      }
      else if (State == State.DataLoaded)
      {
          // Store a reference to the Tick Replay indicator before State.Historical
          // Doing so ensures the hosted indicator will run through Tick Replay
          myTickReplayIndicator = TickReplayIndicator();
     
          // For a strategy, you can just call AddChartIndicator(TickReplayIndicator());
          // However this also adds a copy of the indicator to the chart, which may or may not be desired
          // For calculation purposes only, storing the reference should all that needs to be required.
      }
    }
     
    protected override void OnBarUpdate()
    {
      // Access the stored reference which calculates through
      // historical Tick Replay data and print the value as expected
      Print(myTickReplayIndicator[0]);
    }


    The TickReplayIndicator type is a place holder for an indicator that you develop that uses Tick Replay.

    Can I verify, have you created your indicator that uses Tick Replay and have you added that to your add-on when (State == State.DataLoaded) in OnStateChange()?

    Have you enabled Tick Replay in the primary data series as directed in the help guide linked above?

    I look forward to being of further assistance.
    JimNinjaTrader Customer Service

    Comment


      #3
      Thanks for the quick response.

      Yes am referring to that code segment. Now I understand the TickReplayIndicator is my indicator so that fills in that fuzzy part. Why could not find it!

      I am not adding the indicator during OnStateChanged() in the class derived from the AddOnBase() class. My AddOn is using a Tab Control and multiple Tabs. The Indicator which would like to get the replay data lives on each tab page which is added. I add it when the tab page is added and go from there... Is there an OnStateChanged() called at the NTTabPage() level which is where my indicator lives? If that is the case perhaps can insert the call at that level...

      Update: The OnStateChanged() doesn't seem to be around for the Tab pages. If there is a way to Reload the Tick Data via some object or call once my Indicator is setup? it should be easy to iterate through elements in the Tick Data file. Any way to manually suck in the historical tick data info like occurs on a reload on a Chart?
      Last edited by JimB17; 03-14-2017, 12:19 PM.

      Comment


        #4
        Hello JimB17,

        Thanks for writing back.

        I have asked the development team on this matter.

        There is currently no supported way for an Add-On (not a strategy or an indicator) to access Tick Replay.

        If you wish, I may submit a feature request for this on your behalf.

        In the meantime, you may wish to have your indicator write to a global space to access it with your Add-On. This is an approach that is not documented in our help guide and there is not any official support we can provide. If you wish to proceed, you may look into the publicly available MSDN C# documentation which will guide you toward putting together a global scope file in NinjaTrader 8.

        The C# namespace alias qualifier `::` is used to access a member of an aliased namespace. The `::` operator is often used with the `global` alias, an alias for the global namespace


        Keep in mind, you will want to add some logic surrounding your global objects.

        Please let me know if you would like me to submit a feature request for you.
        JimNinjaTrader Customer Service

        Comment


          #5
          Hey thanks Ninja Jim!

          Appreciate the update, and going all the way to Dev staff to find out. And info about global namespace.

          If you ask Dev staff to add anything believe would need an object that lets me access Tick Replay itself not just adding methods to an AddOn. This because actually have four tabs each with three indicators so there are twelve total instances of my Indicator which would need replay run through. (this could multiply as well!)

          I could have each tab load and run through its set of indicators, but that would still be four independent streams of replay needed. Would kinda have to be from an object that wraps the entire replay and lets me feed it out to my subordinate object Indicators at startup.

          The use of a global namespace will be quite useful though. I already have instances of an Indicator which use visibly and in a Strategy which Master/Slaves and uses a disk file for info. Can potentially convert this to a global namespace data set rather than disk which is non-optimal. Also what I am doing in AddOn can lead to global info accessed from the Strategy which will be useful.

          Once again thanks for the feedback and if you want to add anything to Dev feature request it would be an Object that lets me Tick Replay not just adding to AddOn.

          However I'd rather see them tune up NT8 before getting to new functionality as time is always limited as a developer. (I am one myself.)

          -Jim

          Comment


            #6
            Hello JimB17,

            I have submitted the feature request to the development team.

            It is being tracked with the ticket ID SFT-2025. This feature's implementation can be found in the Release Notes of the version of NinjaTrader 8 that includes the feature. You can find the Release Notes here: https://ninjatrader.com/support/help...ease_notes.htm

            You may also write into platformsupport[at]ninjatrader[dot]com and reference the ticket ID to request a status update from one of our technical support technicians.

            Please let us know if we may be of further assistance.
            JimNinjaTrader Customer Service

            Comment


              #7
              I have accessed tick replay (indirectly) using Memory Mapped files.
              Explore memory-mapped files in .NET, which contain file contents in virtual memory, and allow applications to modify the file by writing directly to the memory.


              You can stream data from memory or via a file. It behaves a little like a DataSeries but kept in memory. It's super quick. I find it works better than a static method since you can name your MMFs individually by a string and access anywhere within NT8 or any other .Net application ;-)

              I collect all the data from an open chart and store them in a Time/OHLC struct in memory and then access the MMF within another window. I have done this by 'sending' data from the Analyzer to any chart of my choosing. eg. painting backgrounds.
              The only caveat is sometimes it will be out of sync by a tick because some windows update before others.

              I can't provide an example because I don't have any 'loose' code I can give you.

              Hope that's a start for you.

              Comment


                #8
                That's a great idea, can store and handoff from an Indicator which sees the Historic data.

                Thanks for the idea, should be simple.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by timmbbo, Today, 08:59 AM
                0 responses
                1 view
                0 likes
                Last Post timmbbo
                by timmbbo
                 
                Started by bmartz, 03-12-2024, 06:12 AM
                5 responses
                33 views
                0 likes
                Last Post NinjaTrader_Zachary  
                Started by Aviram Y, Today, 05:29 AM
                4 responses
                14 views
                0 likes
                Last Post Aviram Y  
                Started by algospoke, 04-17-2024, 06:40 PM
                3 responses
                28 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by gentlebenthebear, Today, 01:30 AM
                1 response
                8 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Working...
                X