Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ExitLong in Backtest Resulting in Odd Delays and Prices

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

    ExitLong in Backtest Resulting in Odd Delays and Prices

    Hello!

    I seem to be running into an issue when trying to exit long positions with an automated strategy. Previously everything was working as expected when working with 5 minute candles, but as soon as I switched over to tick candles, the trade exits appear to be significantly delayed and at odd prices (no where near charted prices).

    I enter my positions using EnterLong(<quantity>) and exit using ExitLong(), and enforce that I only enter trades when I am flat, and exit when long (should only be one trade in progress at a time).

    After running my strategy in a backtest, as mentioned, the exits appear to be significantly delayed, the prices no where near the charted prices, and have overlapping trades. To debug this, I inserted print statements to print the timestamp of when entering and exiting positions. The printed timestamps are inline with what I expect (no overlapping trades), but are also quite different from the timestamps shown in the Historical Strategy Performance view.

    Attached are screenshots of: 1) Chart with misaligned exits, 2) Historical Strategy Performance view listing trades and their overlapping times, and 3) debugging print statements showing different times than Historical Performance view.

    Would appreciate any help that may shed light on what may be happening here! Thanks!
    Attached Files

    #2
    Hello tgilbrough,

    Are you submitting the exits from a secondary series? They seem to possibly line up with the 5 minute series in the image you provided.

    I look forward to being of further assistance.

    Comment


      #3
      Hi Jesse,

      That's exactly what it was. Updated the strategy to make sure to submit orders on the tick-based series and everything is working as expected again.

      Thanks for the quick help!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by abelsheila, 05-14-2025, 07:38 PM
      2 responses
      53 views
      0 likes
      Last Post hglover945  
      Started by nailz420, 05-14-2025, 09:14 AM
      1 response
      103 views
      0 likes
      Last Post NinjaTrader_ChristopherJ  
      Started by NinjaTrader_Brett, 05-12-2025, 03:19 PM
      0 responses
      487 views
      1 like
      Last Post NinjaTrader_Brett  
      Started by domjabs, 05-12-2025, 01:55 PM
      2 responses
      81 views
      0 likes
      Last Post domjabs
      by domjabs
       
      Started by Morning Cup Of Trades, 05-12-2025, 11:50 AM
      1 response
      119 views
      0 likes
      Last Post NinjaTrader_ChristopherJ  
      Working...
      X