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 llanqui, Today, 10:32 AM
      0 responses
      1 view
      0 likes
      Last Post llanqui
      by llanqui
       
      Started by StockTrader88, 03-06-2021, 08:58 AM
      45 responses
      3,992 views
      3 likes
      Last Post johntraderuser2  
      Started by TAJTrades, Today, 09:46 AM
      0 responses
      7 views
      0 likes
      Last Post TAJTrades  
      Started by rhyminkevin, Yesterday, 04:58 PM
      5 responses
      62 views
      0 likes
      Last Post dp8282
      by dp8282
       
      Started by realblubb, Today, 09:28 AM
      0 responses
      8 views
      0 likes
      Last Post realblubb  
      Working...
      X