Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnMarketData - Replay for indicators referenced by a strategy.

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

    OnMarketData - Replay for indicators referenced by a strategy.

    We have an indicator that relies on tick replay for historical calculations, and does its work using OnMarketData to get the latest bid and ask for each trade tick.

    We want to call this indicator from a strategy, but find that while the indicator receives OnMarketData for each tick during a tick replay if it is directly on the chart, when the strategy calls it from NinjaScript code it does not receive any OnMarketData calls until it reaches realtime data.

    The strategy and the indicator are set to update on each tick, and the data series is set to do a tick replay.

    Still, the OnMarketData only fires during the replay for indicators directly on the chart, not for indicators referenced by a strategy.

    How can this be resolved?

    #2
    Hello TapeReader,

    Thank you for your post.

    We are looking into this. I will respond here when I have further information for you.

    Comment


      #3
      I have confirmed the same behavior you see and I am working with the development team concerning this matter. Thank you for your patience.

      Comment


        #4
        This has been reported to development as it is not expected behavior.

        Comment


          #5
          Hi

          I do not see mention of this in the .9 release notes.

          Is there a status update available for this issue?

          Thanks,
          T

          Comment


            #6
            Hello TapeReader,

            Thank you for your post.

            No update on this item at this time.

            Comment


              #7
              Hi,

              Is there a status update available for this issue?

              Thanks,
              C

              Comment


                #8
                Hi Patrick,
                This is an issue for me as well. I was wondering if there is a tracking number for this issue yet?

                Comment


                  #9
                  No update at this time. It is still being investigated.

                  Comment


                    #10
                    I can provide some insight here, depending on exactly how you are referencing the indicator in your strategy code.

                    Am I correct in assuming that you are referencing the indicator in OnBarUpdate() or another event-driven method, and not referencing it in OnStateChange when State == Configure? If so, then that would cause the issue that you are seeing. Without a reference to the indicator in State.Configure (either by instantiating it or using AddChartIndicator()), the strategy will not know that it needs to use Tick Replay to process historical bars, which will cause it to run without any historical calls to OnMarketData().

                    If this applies in your instance, you can use one of the following ways to reference the indicator in State.Configure:

                    Code:
                    if (State == State.Configure)
                    {
                        MyTickReplayInidcator = TickReplayIndicator();  // storing a reference
                    
                       AddChartIndicator(TickReplayIndicator(); // add a chart indicator through strategy
                    }
                    With that in place, you should see your historical OnMarketData() iterations, and should see the indicator behave the same as it does when applied directly on a chart.
                    Dave I.NinjaTrader Product Management

                    Comment


                      #11
                      Dave,

                      Thank you for suggesting this as a way to get it to work. I will re-test the issue with a reference as you have suggested.
                      Bruce DeVault
                      QuantKey Trading Vendor Services
                      NinjaTrader Ecosystem Vendor - QuantKey

                      Comment


                        #12
                        Dave,

                        I have tested this here today, and it does work. Thank you for posting the explanation.
                        Bruce DeVault
                        QuantKey Trading Vendor Services
                        NinjaTrader Ecosystem Vendor - QuantKey

                        Comment


                          #13
                          Thanks for confirming. We have some documentation changes pending under 'Developing for tick replay' that will help address this policy as well as several others.
                          MatthewNinjaTrader Product Management

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by usazencort, Today, 01:16 AM
                          0 responses
                          1 view
                          0 likes
                          Last Post usazencort  
                          Started by kaywai, 09-01-2023, 08:44 PM
                          5 responses
                          602 views
                          0 likes
                          Last Post NinjaTrader_Jason  
                          Started by xiinteractive, 04-09-2024, 08:08 AM
                          6 responses
                          22 views
                          0 likes
                          Last Post xiinteractive  
                          Started by Pattontje, Yesterday, 02:10 PM
                          2 responses
                          20 views
                          0 likes
                          Last Post Pattontje  
                          Started by flybuzz, 04-21-2024, 04:07 PM
                          17 responses
                          230 views
                          0 likes
                          Last Post TradingLoss  
                          Working...
                          X