Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Is it possible for a strategy to not run a historical backtest when enabled?

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

    Is it possible for a strategy to not run a historical backtest when enabled?

    Hello,

    I do not want my strategy to run a historical backtest when I enable my strategy because it takes a VERY long time (strategy is extremely complicated) AND I have a variable in the strategy that changes to a value that I do not want when the strategy undergoes historical backtesting prior to running on SIM or live trading.

    Basically I want the strategy to start with default variable values (not modified by what occurs during historical backtest), and I do not want the historical backtest to be run at all.I want the strategy to start processing data when it is enabled, and not be influenced by historical data.

    How can I do this in strategy builder?

    #2
    Hello burmaz,

    In the Strategy Builder you would need to add to every condition Misc -> Current state, Equals, Misc -> State Realtime.


    In an unlocked script you could do this with 2 simple lines of code at the top of OnBarUpdate().

    if (State == State.Historical)
    return;

    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello burmaz,

      In the Strategy Builder you would need to add to every condition Misc -> Current state, Equals, Misc -> State Realtime.


      In an unlocked script you could do this with 2 simple lines of code at the top of OnBarUpdate().

      if (State == State.Historical)
      return;

      https://ninjatrader.com/support/foru...541#post811541
      Thank you for your help! That answered my issue.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      77 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      40 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      63 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      63 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      53 views
      0 likes
      Last Post CarlTrading  
      Working...
      X