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

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.
    JesseNinjaTrader Customer Service

    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 popecapllc, 08-09-2023, 07:42 PM
      11 responses
      1,873 views
      0 likes
      Last Post tradgrad  
      Started by morrnel, 05-12-2024, 06:07 PM
      7 responses
      106 views
      1 like
      Last Post tradgrad  
      Started by mmike, Yesterday, 10:33 PM
      0 responses
      4 views
      0 likes
      Last Post mmike
      by mmike
       
      Started by Pole123, Yesterday, 06:02 PM
      0 responses
      8 views
      0 likes
      Last Post Pole123
      by Pole123
       
      Started by samish18, Yesterday, 05:27 PM
      0 responses
      5 views
      0 likes
      Last Post samish18  
      Working...
      X