Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

backtest vs live / replay issue

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

    backtest vs live / replay issue

    I ran my script live - 0 trades
    ran a backtest - showed 1 or 2 trades for the same time
    ran a replay - 0 trades

    put it thru debugger on replay.. conditions were not met. After wrestling with it, here is what I found.

    a bit of a background:
    barsinprogress 0,1,3,4..8 on primary instrument
    barsinprogress 2 on secondary instrument.

    bip 0,3,4..8 call Closes[2][0] which updates regularly in backtest. When script executes on historical data on the chart (in live/replay) it updates until the last but one bar which is about right.

    But when transitioning to live/replay data (actual replay starts), Closes[2][0] stops updating and same value (last but one bar close of secondary instrument's historical data on chart) is returned through out (live/replay bars) and hence conditions never triggered. Consequently, no trades in live/replay.

    On the replay chart, I see both instruments moving but the output remaining stagnant for Closes[2][0] when called from primary instrument' bip.

    This is perhaps maybe due to the way bars are calculated (backward to forward) during the transition from historical to current data. Someone needs to fix Closes array.

    #2
    tradejockey,

    You will only get updated values of Closes[2][0] in your other BIPs after you get an event for BIP2. Otherwise you are still using the old value. Check your CalculateOnBarClose setting. If it is true, you will only get new Closes[2][0] values when the bar closes.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks for replying... Ofcourse, it is set to true..

      To help demonstrate the gravity of the situation, I am attaching the output and screenshot. Output will show the Closes[2][0] updating correctly (being printed from primary's bips) upto the transition from historical to current where it stops updating.

      Please note that the ending time is 3:59pm (end of historical chart data) and beginning time of live/replay is 2:01 am. Please search for these in the output.txt. You will see that 5677.00 keeps repeating during live/replay. 5677.00 is the close of last but one bar of previous day.
      Attached Files

      Comment


        #4
        Please attach your strategy. Thank you.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          When I tried to strip my strategy down to attach, I realized my mistake. Its a rookie mistake. I was testing my strategy in ##-## instruments and forgot to change the secondary instrument back to 12-09. It was just convenient to export out all the quarters into ##-## and test since I neednt change the instrument and recompile everytime I wanted to test for a quarter.

          Comment


            #6
            Glad its resolved and thanks for posting your update.
            RayNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            621 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            359 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            105 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            562 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            567 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X