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

Don't understand Market Replay

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

    Don't understand Market Replay

    Hi,
    My primary timeframe is 1min. My secondary timeframe is 1s. Tick Replay for the data is OFF. My indicator is set to calculate on each tick.
    I'm playing back data using Market Replay and looking at the volume each time there is call into OnUpdate and I don't understand the output for BarsInProgress=1.

    So say the volume for the trade is 100 (verfied using firstly secondary tick data), I get output for every single (I assume) individual volume going from 1 to 100. i.e. there are 100 calls to OnUpdate.
    Is this the expected behaviour and why?
    Thank-you,
    iq

    #2
    Hi, thanks for posting. Can you provide a test script that demonstrates your question? Are you asking why you are getting 100 calls to OnBarUpdate when BarsOnProgress == 1 when you are expecting 60 calls to OnBarUpdate?

    Kind regards,
    -ChrisL
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hi Chris,
      I am including some relevant code for the issue I described.

      I was using NQ 03-18 but you should be able to replicate the output for any instrument and adjusting the time interval in the code.

      So as I mentioned, my primary data stream is 1min. My secondary data stream is 1sec. I am updating the chart every tick.
      In the code, I am recording the volume during realtime tick replay for a couple of minutes which is why I have the coe between two time intervals.

      Now my question is when I run this during tick replay, I am getting output as per output.txt.

      I was expecting that even though the chart update is per tick, i would get a burst of volume for that second where the volume has ocurred and 0 other times when there are no trades but instead, Ninjatrader 8 seems to be splitting the trade volume per second.

      I am using Ninjatrader 8.0.25.0

      Regards,
      iq
      Attached Files
      Last edited by iq200; 01-25-2022, 12:09 PM.

      Comment


        #4
        Hi, thanks for your reply.

        If you want the volume at each second you would run the script OnBarClose and read the Volume value every time BarsInProgress ==1. If you run the script
        OnEachTick you are getting an update on every incoming tick and the volume value will vary between each OnBarUpdate call. Please reference either the BuySellVolume1Tick sample (attached) or the BuySellVolume indicator that comes with the platform that shows how to accumulate buy/sell volume in OnMarketData using Tick replay.

        Kind regards,
        -ChrisL
        Attached Files
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_ChrisL View Post
          Hi, thanks for your reply.

          If you want the volume at each second you would run the script OnBarClose and read the Volume value every time BarsInProgress ==1. If you run the script
          OnEachTick you are getting an update on every incoming tick and the volume value will vary between each OnBarUpdate call. Please reference either the BuySellVolume1Tick sample (attached) or the BuySellVolume indicator that comes with the platform that shows how to accumulate buy/sell volume in OnMarketData using Tick replay.

          Kind regards,
          -ChrisL
          Hi Chris,
          I can't use tick replay as Ninjatrader 8 grinds to a halt if i am running 20-30 charts all with tick replay. I've seen other people on this forum and other forums having this problem.

          When you say "you are getting an update on every incoming tick" what kind of tick do you mean? volume price or time?

          In the output file I sent, what does it mean for the volume count to increment by 1 each time? For example at 08:59:02, the volume count increases by one to 11. I don't understand why the volume is increasing by one each time. Does this mean the total volume at 08:59:02 is 11? If so, why does it not just print a single line with 11?
          Thanks,
          iq

          Comment


            #6
            Hi, thanks for your reply.

            Here is the definition of a Tick from the publicly available Investopedia:
            https://www.investopedia.com/terms/t...s%20one%20cent.

            The time frame you have set up, in 2017 is impossible for me to test because I only have historical tick data for 180 days prior to today. When I print out the time and volume in BIP=1, I get a timestamp and a volume value for that second. When there are multiple ticks on the same second the volume is accumulated, then reset on the next second bar.

            Please let me know if I can answer any other questions.
            -ChrisL

            Chris L.NinjaTrader Customer Service

            Comment


              #7
              Chris, I'm confused. I tried on the current NQ contract (03-22) and I get similar results as before.
              What data are you using? Can I please see the exact code you used? May I also see the results you are getting?
              Thanks,
              iq

              Comment


                #8
                Hi, thanks for your reply.

                My script is running a 1 minute primary series and a 1 second added series. The code is:

                if (BarsInProgress == 1)
                {
                Print(Times[1][0] + " " + Volumes[1][0]);
                }

                And the output is :
                1/25/2022 3:53:54 PM 86
                1/25/2022 3:53:55 PM 84
                1/25/2022 3:53:55 PM 84
                1/25/2022 3:53:55 PM 111
                1/25/2022 3:53:55 PM 111
                1/25/2022 3:53:56 PM 80

                Kind regards,
                -ChrisL
                Chris L.NinjaTrader Customer Service

                Comment


                  #9
                  Hi Chris,
                  Thanks for your reply with the info.
                  I noticed you mentioned in an earlier message you're running your test with historical tick data. Are you using playback market replay tho? The output I'm getting is not with the historical data but from market replay in realtime mode.
                  Regards,
                  iq
                  Last edited by iq200; 01-26-2022, 04:54 AM.

                  Comment


                    #10
                    Hi, thanks for your reply.

                    I am running this on real time data, I get the same results in replay data. The method in your code is manipulating the data and summing up the volume value, if you just put what I have you should get similar results.

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

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by wzgy0920, 04-20-2024, 06:09 PM
                    2 responses
                    27 views
                    0 likes
                    Last Post wzgy0920  
                    Started by wzgy0920, 02-22-2024, 01:11 AM
                    5 responses
                    32 views
                    0 likes
                    Last Post wzgy0920  
                    Started by wzgy0920, 04-23-2024, 09:53 PM
                    2 responses
                    74 views
                    0 likes
                    Last Post wzgy0920  
                    Started by Kensonprib, 04-28-2021, 10:11 AM
                    5 responses
                    193 views
                    0 likes
                    Last Post Hasadafa  
                    Started by GussJ, 03-04-2020, 03:11 PM
                    11 responses
                    3,235 views
                    0 likes
                    Last Post xiinteractive  
                    Working...
                    X