Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Different entry points when using live sim vs market replay

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

    Different entry points when using live sim vs market replay

    Hello, I'm trying to backtest a strategy and I got different entry points when doing live sim using rithmic connection via Topstep. This really threw me off as my pnl results were differnt.
    When I did market replay I got different entry points. Strategy is doing market order.
    On market replay, I tried both ways to get the data
    1. Connection set to Topstep and then downloading the market replay data for mnq jun 25 for 2025-03-19
    2. Connection set to Playback and downloading market replay data

    Both sets of data yielded same result when doing market replay.
    The strategy logic put a market order short at 19799.5
    It filled me at 19795.5


    The live sim filled me at 19798.75 vs market replay at 19795.5 (strategy fired market short at 19799.5)

    Here's some output I got for the marketreplay

    Code:
    #2025-03-19 10.54 MNQ
    
    marketDataUpdateinstrument='MNQ JUN25 Globex' type=Last price=19800 volume=1 time='2025-03-19 10:54:04 AM' bid=19800 ask=19800.25 isReset=False
    marketDataUpdateinstrument='MNQ JUN25 Globex' type=Last price=19799.75 volume=2 time='2025-03-19 10:54:04 AM' bid=19799.75 ask=19800 isReset=False
    marketDataUpdateinstrument='MNQ JUN25 Globex' type=Last price=19799.75 volume=1 time='2025-03-19 10:54:04 AM' bid=19799.75 ask=19800 isReset=False
    marketDataUpdateinstrument='MNQ JUN25 Globex' type=Last price=19799.75 volume=5 time='2025-03-19 10:54:04 AM' bid=19799.75 ask=19800 isReset=False
    marketDataUpdateinstrument='MNQ JUN25 Globex' type=Last price=19799.75 volume=1 time='2025-03-19 10:54:04 AM' bid=19799.75 ask=19800 isReset=False
    marketDataUpdateinstrument='MNQ JUN25 Globex' type=Last price=19799.75 volume=1 time='2025-03-19 10:54:04 AM' bid=19799.75 ask=19800 isReset=False
    marketDataUpdateinstrument='MNQ JUN25 Globex' type=Last price=19799.75 volume=1 time='2025-03-19 10:54:04 AM' bid=19799.75 ask=19800 isReset=False
    marketDataUpdateinstrument='MNQ JUN25 Globex' type=Last price=19799.75 volume=1 time='2025-03-19 10:54:04 AM' bid=19799.75 ask=19800 isReset=False
    marketDataUpdateinstrument='MNQ JUN25 Globex' type=Last price=19799.75 volume=1 time='2025-03-19 10:54:04 AM' bid=19799.75 ask=19800 isReset=False
    marketDataUpdateinstrument='MNQ JUN25 Globex' type=Last price=19799.75 volume=1 time='2025-03-19 10:54:04 AM' bid=19799.75 ask=19800 isReset=False
    onorderupdate:orderId='555908ca01a64dae8dfe5475d39a7cb2' account='Playback101' name='S' orderState=Submitted instrument='MNQ JUN25' orderAction=SellShort orderType='Market' limitPrice=0 stopPrice=0 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=42163 time='2025-03-19 10:54:05' gtd='2099-12-01' statementDate='2025-03-19'
    onorderupdate:orderId='555908ca01a64dae8dfe5475d39a7cb2' account='Playback101' name='S' orderState=Accepted instrument='MNQ JUN25' orderAction=SellShort orderType='Market' limitPrice=0 stopPrice=0 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=42163 time='2025-03-19 10:54:05' gtd='2099-12-01' statementDate='2025-03-19'
    onorderupdate:orderId='555908ca01a64dae8dfe5475d39a7cb2' account='Playback101' name='S' orderState=Working instrument='MNQ JUN25' orderAction=SellShort orderType='Market' limitPrice=0 stopPrice=0 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=42163 time='2025-03-19 10:54:05' gtd='2099-12-01' statementDate='2025-03-19'
    onorderupdate:orderId='555908ca01a64dae8dfe5475d39a7cb2' account='Playback101' name='S' orderState=Filled instrument='MNQ JUN25' orderAction=SellShort orderType='Market' limitPrice=0 stopPrice=0 quantity=1 tif=Gtc oco='' filled=1 averageFillPrice=19795.5 onBehalfOf='' id=42163 time='2025-03-19 10:54:05' gtd='2099-12-01' statementDate='2025-03-19'
    onorderupdate:orderId='5afc5f69bdfc4a78b1847a27705a67dd' account='Playback101' name='Stop loss' orderState=Submitted instrument='MNQ JUN25' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=19815.5 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=42164 time='2025-03-19 10:54:05' gtd='2099-12-01' statementDate='2025-03-19'
    onorderupdate:orderId='5afc5f69bdfc4a78b1847a27705a67dd' account='Playback101' name='Stop loss' orderState=Accepted instrument='MNQ JUN25' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=19815.5 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=42164 time='2025-03-19 10:54:05' gtd='2099-12-01' statementDate='2025-03-19'
    onorderupdate:orderId='364399b5a989479cbdacc951dbc38a23' account='Playback101' name='Profit target' orderState=Submitted instrument='MNQ JUN25' orderAction=BuyToCover orderType='Limit' limitPrice=19783.25 stopPrice=0 quantity=1 tif=Gtc oco='00c4b5ccb8be442eafc382e91d1eb401' filled=0 averageFillPrice=0 onBehalfOf='' id=42165 time='2025-03-19 10:54:05' gtd='2099-12-01' statementDate='2025-03-19'
    onorderupdate:orderId='364399b5a989479cbdacc951dbc38a23' account='Playback101' name='Profit target' orderState=Accepted instrument='MNQ JUN25' orderAction=BuyToCover orderType='Limit' limitPrice=19783.25 stopPrice=0 quantity=1 tif=Gtc oco='00c4b5ccb8be442eafc382e91d1eb401' filled=0 averageFillPrice=0 onBehalfOf='' id=42165 time='2025-03-19 10:54:05' gtd='2099-12-01' statementDate='2025-03-19'
    onorderupdate:orderId='364399b5a989479cbdacc951dbc38a23' account='Playback101' name='Profit target' orderState=Working instrument='MNQ JUN25' orderAction=BuyToCover orderType='Limit' limitPrice=19783.25 stopPrice=0 quantity=1 tif=Gtc oco='00c4b5ccb8be442eafc382e91d1eb401' filled=0 averageFillPrice=0 onBehalfOf='' id=42165 time='2025-03-19 10:54:05' gtd='2099-12-01' statementDate='2025-03-19'
    marketDataUpdateinstrument='MNQ JUN25 Globex' type=Last price=19799.5 volume=1 time='2025-03-19 10:54:04 AM' bid=19799.5 ask=19800 isReset=False
    marketDataUpdateinstrument='MNQ JUN25 Globex' type=Last price=19799.5 volume=1 time='2025-03-19 10:54:04 AM' bid=19799.5 ask=19800 isReset=False
    marketDataUpdateinstrument='MNQ JUN25 Globex' type=Last price=19799.5 volume=1 time='2025-03-19 10:54:04 AM' bid=19799.5 ask=19800 isReset=False
    marketDataUpdateinstrument='MNQ JUN25 Globex' type=Last price=19799.5 volume=1 time='2025-03-19 10:54:04 AM' bid=19799.5 ask=19800 isReset=False
    marketDataUpdateinstrument='MNQ JUN25 Globex' type=Last price=19799.5 volume=1 time='2025-03-19 10:54:04 AM' bid=19799.5 ask=19800 isReset=False
    marketDataUpdateinstrument='MNQ JUN25 Globex' type=Last price=19799.5 volume=1 time='2025-03-19 10:54:04 AM' bid=19799.5 ask=19800 isReset=False
    marketDataUpdateinstrument='MNQ JUN25 Globex' type=Last price=19799.5 volume=1 time='2025-03-19 10:54:04 AM' bid=19799.5 ask=19800 isReset=False
    marketDataUpdateinstrument='MNQ JUN25 Globex' type=Last price=19799.25 volume=1 time='2025-03-19 10:54:04 AM' bid=19799.25 ask=19800 isReset=False
    marketDataUpdateinstrument='MNQ JUN25 Globex' type=Last price=19799.25 volume=1 time='2025-03-19 10:54:04 AM' bid=19799.25 ask=19800 isReset=False
    marketDataUpdateinstrument='MNQ JUN25 Globex' type=Last price=19799.25 volume=1 time='2025-03-19 10:54:04 AM' bid=19799.25 ask=19800 isReset=False
    marketDataUpdateinstrument='MNQ JUN25 Globex' type=Last price=19799.25 volume=1 time='2025-03-19 10:54:04 AM' bid=19799.25 ask=19800 isReset=False
    marketDataUpdateinstrument='MNQ JUN25 Globex' type=Last price=19799.25 volume=1 time='2025-03-19 10:54:04 AM' bid=19799.25 ask=19800 isReset=False
    marketDataUpdateinstrument='MNQ JUN25 Globex' type=Last price=19799.25 volume=1 time='2025-03-19 10:54:04 AM' bid=19799.25 ask=19800 isReset=False
    marketDataUpdateinstrument='MNQ JUN25 Globex' type=Last price=19​
    As you can see the print output, the price was at 19799.75
    then the order filled at 19795.5
    and the next tick shows price at 19799.5 again


    I would like to do backtesting using zero slippage. To get similar scenario I just created a basic strategy logic

    that if price is within range, then take short

    To emulate this scenario use market replay for mnq 2025-03-19
    Code:
    PriceRangeStart = 19799.5;
    PriceRangeEnd = 19787.25;
    
    bool inPriceRange = currentPrice <= PriceRangeStart && currentPrice >= PriceRangeEnd;
    if (inPriceRange)
                {
                    if (Position.MarketPosition == MarketPosition.Flat)
                    {
                        EnterShort();
                        SetProfitTarget(CalculationMode.Ticks, ProfitTicks);
                        SetStopLoss(CalculationMode.Ticks, StopLossTicks);
                    }
                }​

    #2
    Any inputs?

    Comment


      #3
      Hello techbid,

      Below is a link to a support article on comparing strategy results which details what causes differences and includes a video and sample strategy that demonstrates writing information to file to compare and find what specifically is causing differences.


      Note, the stop losses and profit targets would not fill intra-bar in historical and will fill with end-of-bar data. This will cause differences.
      Intra-bar granularity with Exit orders would be necessary for this to fill accurately in historical.
      Chelsea B.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      41 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      124 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      64 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      41 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      46 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X