Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Market Replay is not hitting the OnBarUpdate method

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

    Market Replay is not hitting the OnBarUpdate method

    Versions
    8.1.3.1
    8.1.4.0

    Everything seemed fine with 8.1.3.1. I updated to 8.1.4.0 and it seemed to initially work, but I noticed the Market Replay stopped hitting the OnBarUpdate. I uninstalled and reinstalled the previous version. Now, I'm not seeing the Market Replay hit the OnBarUpdate at all. I removed all third party add-ons and it works in live.​
    Attached Files

    #2
    Hello WaleeTheRobot,

    Which playback mode are you using? Also have you tried to delete the data and re download it?

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Hello WaleeTheRobot,

      Which playback mode are you using? Also have you tried to delete the data and re download it?
      I'm using the Market Replay data where you click to play replay the day and not the Historical. I downloaded this week's NQ 03-25 data this morning and still had the same issue. This is the print from the attached strategy. It no longer prints after the data starts to replay.

      Code:
      OnBarUpdate called at 12/16/2024 9:45:17 AM | BarsInProgress: 0 | Current State: Historical
      OnBarUpdate called at 12/16/2024 9:45:17 AM | BarsInProgress: 0 | Current State: Historical
      OnBarUpdate called at 12/16/2024 9:45:17 AM | BarsInProgress: 0 | Current State: Historical
      OnBarUpdate called at 12/16/2024 9:45:17 AM | BarsInProgress: 0 | Current State: Historical
      OnBarUpdate called at 12/16/2024 9:45:18 AM | BarsInProgress: 0 | Current State: Historical
      OnBarUpdate called at 12/16/2024 9:45:18 AM | BarsInProgress: 0 | Current State: Historical
      State changed to: Transition at 12/20/2024 10:59:13 AM
      Enabling NinjaScript strategy 'MyCustomStrategy/346175899' : On starting a real-time strategy - StartBehavior=WaitUntilFlat EntryHandling=All entries EntriesPerDirection=1 StopTargetHandling=Per entry execution ErrorHandling=Stop strategy, cancel orders, close positions ExitOnSessionClose=True / triggering 30 seconds before close SetOrderQuantityBy=Strategy ConnectionLossHandling=Recalculate DisconnectDelaySeconds=10 CancelEntriesOnStrategyDisable=False CancelExitsOnStrategyDisable=False Calculate=On each tick IsUnmanaged=False MaxRestarts=4 in 5 minutes
      State changed to: Realtime at 12/20/2024 10:59:13 AM
      Transitioned to real-time.​
      This is the log
      Code:
      2024-12-20 10:58:05:969|2|4|Session Break (Version 8.1.3.1)
      2024-12-20 10:58:18:427|1|4|Global simulation mode disabled
      2024-12-20 10:58:19:340|1|4|Automated trading disabled
      2024-12-20 10:58:19:344|1|2|Using IS (is-us-nt-006.ninjatrader.com/31658)
      2024-12-20 10:58:19:594|1|32|Order entry hot keys enabled
      2024-12-20 10:58:19:595|1|4|Auto close enabled=False
      2024-12-20 10:58:20:963|1|4|Restoring workspace 'Dev'...
      2024-12-20 10:58:33:585|1|2|Playback: Primary connection=Connecting, Price feed=Connecting
      2024-12-20 10:58:33:774|1|2|Playback: Primary connection=Connected, Price feed=Connected
      2024-12-20 10:58:33:776|1|2|Time to auto close position='12:00:00 AM', Enabled=False
      2024-12-20 10:58:33:777|1|2|Using HDS (hds-us-nt-016.ninjatrader.com/31655)
      2024-12-20 10:58:34:100|1|2|Simulation account 'Playback101' reset
      2024-12-20 10:58:44:067|1|2|Simulation account 'Playback101' reset
      2024-12-20 10:58:55:945|1|2|Simulation account 'Playback101' reset
      2024-12-20 10:59:07:419|1|16|Backtesting with Tick Replay was not designed to provide higher accuracy concerning order fills and execution in historical. For higher granularity you can utilize Order Fill Resolution 'high' outside of Tick Replay.
      2024-12-20 10:59:13:534|1|4|Enabling NinjaScript strategy 'MyCustomStrategy/346175899' : On starting a real-time strategy - StartBehavior=WaitUntilFlat EntryHandling=All entries EntriesPerDirection=1 StopTargetHandling=Per entry execution ErrorHandling=Stop strategy, cancel orders, close positions ExitOnSessionClose=True / triggering 30 seconds before close SetOrderQuantityBy=Strategy ConnectionLossHandling=Recalculate DisconnectDelaySeconds=10 CancelEntriesOnStrategyDisable=False CancelExitsOnStrategyDisable=False Calculate=On each tick IsUnmanaged=False MaxRestarts=4 in 5 minutes
      ​

      Comment


        #4
        Hello WaleeTheRobot,

        Are you playing through session hours? I tried the script and see the following prints:

        OnBarUpdate called at 12/18/2024 11:32:43 PM | BarsInProgress: 1 | Current State: Realtime
        OnBarUpdate called at 12/18/2024 11:32:43 PM | BarsInProgress: 1 | Current State: Realtime
        OnBarUpdate called at 12/18/2024 11:32:43 PM | BarsInProgress: 1 | Current State: Realtime
        OnBarUpdate called at 12/18/2024 11:33:02 PM | BarsInProgress: 1 | Current State: Realtime
        OnBarUpdate called at 12/18/2024 11:33:03 PM | BarsInProgress: 1 | Current State: Realtime​

        Comment


          #5
          Originally posted by NinjaTrader_Jesse View Post
          Hello WaleeTheRobot,

          Are you playing through session hours? I tried the script and see the following prints:

          OnBarUpdate called at 12/18/2024 11:32:43 PM | BarsInProgress: 1 | Current State: Realtime
          OnBarUpdate called at 12/18/2024 11:32:43 PM | BarsInProgress: 1 | Current State: Realtime
          OnBarUpdate called at 12/18/2024 11:32:43 PM | BarsInProgress: 1 | Current State: Realtime
          OnBarUpdate called at 12/18/2024 11:33:02 PM | BarsInProgress: 1 | Current State: Realtime
          OnBarUpdate called at 12/18/2024 11:33:03 PM | BarsInProgress: 1 | Current State: Realtime​
          I'm not sure why it wasn't working for me. I ended uninstalling NT, removing all the folders and reinstalling it. It seems to work fine now. Thanks.

          Comment


            #6
            I think I found the issue. I had a copy of System.Text.Json in the Custom directory. I didn't see any issues with it until I did a clean uninstall and removed the NT files. With the new clean installation, I copied it over from the .nuget directory and noticed NT complaining about not being able to load it when starting up NT. I removed it from NT Custom directory and reference it in .nuget directory and the loading issue went away and the OnBarUpdate issue went away. It seems that something was silently failing somewhere.

            Edit:
            I saw that there was one in C:\Program Files\NinjaTrader 8\bin\System.Text.Json.dll and thats the only one I got to work. I kept getting could not load assembly compile error if I copy it into Custom or if I reference .nuget then I get runtime errors for System.Text.Json.
            Last edited by WaleeTheRobot; 12-20-2024, 09:25 PM.

            Comment


              #7
              This is kind of frustrating since I thought it was the referencing of the dlls. However, that was intermittent and it stopped hitting OnBarUpdate again. This is how I got it to consistently hit the OnBarUpdate when I click the play button for replay. Right click the chart and add the strategy. Check Enabled and click play. It'll now play like normal and enter the OnBarUpdate method. If I don't select Enabled on initial load of the strategy and click the Enabled in the Strategies tab with Accounts, Orders, etc then it won't enter the OnBarUpdate anymore. I attached the screenshots and an updated strategy. It just has a simple method to test the System.Text.Json. This is on version 8.1.4.0. I did notice the same behavior previously when I uninstalled 8.1.4.0 without removing all the files from NT and going back to 8.1.3.0. I didn't have this issue before upgrading to 8.1.4.0 the first time.
              Attached Files

              Comment


                #8
                Hello WaleeTheRobot,

                While I cannot assist with external nuget packages you can do this type of test without using that reference at all. If you are adding references that are newer versions of something NinjaTrader already uses that may cause issues, you can instead reference the version installed with NinjaTrader.

                Regarding enabling the strategy, are you applying a new instance of the strategy and then checking the enabled box on that new instance after connecting to playback? If you are using an instance that previously was applied outside of playback that wont work, you need a new instance applied after connecting to playback so it selects the playback account.

                Comment


                  #9
                  Thanks. I think the issue probably is because I'm referencing something other than the one NT is using. I noticed NT having issues between compile or runtime referencing dlls if I copied them over to the Custom directory or reference it in a different directory. Referencing the below for the NinjaScript Editor worked.

                  C:\Program Files\NinjaTrader 8\bin\System.Text.Json.dll
                  C:\Program Files\NinjaTrader 8\bin\System.Memory.dll​

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  580 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  335 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  101 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  554 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  552 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X