Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Preventing Backtesting when enabling a strategy

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

    Preventing Backtesting when enabling a strategy

    Hello Ninjatrader Support,

    I'm currently trying to perfect a work around for creating a strategy that manages my exits only. Since this isn't possible in the current version of NT, my thought process has been to create a strategy that trades on the open of next bar when enabled and then manages the exit accordingly.

    The problem is I only want the strategy to handle one order the entire time it is enabled. With maxpositions, the strategy currently enters, exits, and then re-enters at the open of the next bar after a close.

    In an attempt to remedy this issue, I implemented a counter that prevents more than one entry from occurring during the life of the strategy (if counter == 0, trade). However, when I enable my strategy, the historical backtesting that goes along with it brings the counter to 1, thus preventing any live trading.

    What is a functional solution to this problem?

    Thanks

    #2
    Hi Elynt, welcome to our forums. One approach would be to not process anything historical then and just return out - https://www.ninjatrader.com/support/...historical.htm

    So your logic would then only kick into gear once realtime bars are processed by the script.

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      Hi Elynt, welcome to our forums. One approach would be to not process anything historical then and just return out - https://www.ninjatrader.com/support/...historical.htm

      So your logic would then only kick into gear once realtime bars are processed by the script.
      Brilliantly simple. Thank you for the help!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      61 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      39 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      21 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      23 views
      0 likes
      Last Post TheRealMorford  
      Started by Mindset, 02-28-2026, 06:16 AM
      0 responses
      51 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X