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

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 burtoninlondon, Today, 12:38 AM
      0 responses
      5 views
      0 likes
      Last Post burtoninlondon  
      Started by AaronKoRn, Yesterday, 09:49 PM
      0 responses
      14 views
      0 likes
      Last Post AaronKoRn  
      Started by carnitron, Yesterday, 08:42 PM
      0 responses
      11 views
      0 likes
      Last Post carnitron  
      Started by strategist007, Yesterday, 07:51 PM
      0 responses
      13 views
      0 likes
      Last Post strategist007  
      Started by StockTrader88, 03-06-2021, 08:58 AM
      44 responses
      3,982 views
      3 likes
      Last Post jhudas88  
      Working...
      X