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 jjs12, Today, 10:29 AM
      0 responses
      3 views
      0 likes
      Last Post jjs12
      by jjs12
       
      Started by lakman184, 03-24-2024, 01:30 PM
      5 responses
      28 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by thumper57, 05-11-2024, 04:30 PM
      16 responses
      44 views
      0 likes
      Last Post thumper57  
      Started by Salahinho99, 05-05-2024, 04:13 AM
      10 responses
      70 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by lorem, 04-25-2024, 09:18 AM
      13 responses
      56 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X