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

OnBarUpdate does not work in Replay on CL

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

    OnBarUpdate does not work in Replay on CL

    I have an indicator which uses OnMarketData and OnBarUpdate. I'm testing it out on NQ and CL in market replay mode on 5/8/18. NQ plots the output from the indicator but CL does not. I am able to place a breakpoint in OBU when the indicator is loading, but during the actual replay process the breakpoint in OBU is not hit in CL. What steps can I take to fix this?

    Edit: With Tick Replay disabled, it appears to work, not sure why that would affect it in this case. I would like it to work with Tick Replay enabled.
    Last edited by habibalex; 06-03-2018, 01:30 PM.

    #2
    Hello habibalex,

    Do you have historical tick data for both series for the entire period loading historically?

    In the Playback Controller have you selected Market Replay or Historical Tick data?

    If Market Replay, is there Market Replay data for both series for the entire period?

    If you feel you can confirm this, please include screenshots of the chart, the playback controller, and the historical data window showing both the market replay data and the historical data.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I have historical data for both series for the entire loading period
      Market replay is selected in the playback controller
      Both series have data for market replay for the entire period.

      When I uncheck Tick Replay my indicator data loads correctly and I am able to see the output of the indicator.

      Tick Replay checked w/ NYMEX ETH session: https://imgur.com/a/5DAYCyl
      Tick Replay unchecked w/ NYMEX ETH session: https://imgur.com/a/2KJH7Ew

      for some reason if I use CME RTH US Index session w/ Tick Replay checked it works.

      Comment


        #4
        Hello habibalex,

        For OnMarketData to trigger historically TickReplay must be enabled.

        Below is a public link to the help guide on TickReplay.


        Also from the help guide:
        "2. By default, this method is not called on historical data (backtest), however it can be called historically by using TickReplay"


        However, you mentioned:
        "With Tick Replay disabled, it appears to work, not sure why that would affect it in this case"

        Is this still the case?

        The script could be using OnBarUpdate which would only need a secondary 1 tick series added to trigger events on each tick and build plots using historical ask tick and bid tick data.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Yes w/ Tick Replay disabled the indicator is working as expected during Playback. However w/ it enabled OBU is not being called on the 'live' playback data

          Comment


            #6
            Hello habibalex,

            The script is not triggering OnBarUpdate at all when TickReplay is enabled and State is State.Realtime while playing back ?

            If you print the time at the top of OnBarUpdate no prints appear in real-time data?

            I am not able to reproduce this behavior.

            Attached is a test script and below is a public link to a test that demonstrates. The test script test both OnBarUpdate and OnMarketData, but we are only interested in OnBarUpdate.


            Are you able to reproduce the behavior using the test script I have provided and the steps in the video?


            Did you download the Market Replay data from NinjaTrader's servers in the Historical Data window?

            Do you have a slimmed down test script with only the necessary code to demonstrate the behavior that I can test on my end?
            Attached Files
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              When I set your indicator to Calculate.OnBarClose I do not get any output in the output window for real time trades. With Calculate.OnEachTick set, I get output. Are you able to reproduce that w/ your script?

              Discover the magic of the internet at Imgur, a community powered entertainment destination. Lift your spirits with funny jokes, trending memes, entertaining gifs, inspiring stories, viral videos, and so much more from users.

              Comment


                #8
                Hello habibalex,

                (edited)

                The script is designed not to print for historical data. This is because we are testing real-time playback.

                To confirm, you have played back the entire period in Market Replay and no prints have appeared at all, is this correct?

                I ask because your screenshot is showing that you have not hit play on the Market Replay Controller and nothing has been played back.
                Last edited by NinjaTrader_ChelseaB; 06-07-2018, 08:43 AM.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  pause button shows when you're playing back, the pic is showing no output while playing back

                  Comment


                    #10
                    Umm can hit reduce your script to bare minimum that causes the problem?

                    I'll run it here for cl and es.

                    Comment


                      #11
                      I was running your script and the problem occurs. Remember to set Calculate to OnBarClose and you should see the problem

                      edit:sorry I thought you replied Chelsea

                      Comment


                        #12
                        Hello habibalex,

                        With the indicator set with Calculate as 'On bar close', with TickReplay enabled, in Playback, I am not able to reproduce.



                        Can you provide a video showing that the code in the script has not been changed and showing that you have played back through all of the data?

                        You can use Jing to make short videos for free.

                        Below is a public link to the jing website.
                        TechSmith Capture is a simple, free way to create basic screenshots and screen recordings and share them with others.
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          I downloaded data for market replay data for today and everything worked as expected. I re-downloaded for the data for the day that was not working and it looks like everything is working now as expected now.

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by GussJ, 03-04-2020, 03:11 PM
                          16 responses
                          3,281 views
                          0 likes
                          Last Post Leafcutter  
                          Started by WHICKED, Today, 12:45 PM
                          2 responses
                          19 views
                          0 likes
                          Last Post WHICKED
                          by WHICKED
                           
                          Started by Tim-c, Today, 02:10 PM
                          1 response
                          9 views
                          0 likes
                          Last Post NinjaTrader_ChelseaB  
                          Started by Taddypole, Today, 02:47 PM
                          0 responses
                          5 views
                          0 likes
                          Last Post Taddypole  
                          Started by chbruno, 04-24-2024, 04:10 PM
                          4 responses
                          53 views
                          0 likes
                          Last Post chbruno
                          by chbruno
                           
                          Working...
                          X