Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Enable or Disable Backtesting

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

    Enable or Disable Backtesting

    Can someone tell where within a Ninjascript, I can find the line that enables or disables the strategy from being back-tested? I have a strategy, and it will not allow me to back-test for some reason. When I pull it up in Strategy Analyzer and try to run a back test, nothing happens. So there must be a line in the code preventing this. How can I get it to back-test. Can I just go in and edit the code to let me?

    Thanks!

    #2
    Hello Corbett,

    Thank you for your post.

    Usually "if(Historical)return;" will prevent this, look for this at the beginning of the OnBarUpdate().

    Otherwise, if the backtest still does not work or the line is not present please answer these questions:
    1. Do you see results when running the same test on the SampleMaCrossOver strategy in NinjaTrader with the same settings as your strategy?
    2. Are you connected to your data feed provider when running this test?
    3. Do you have data in the Historical Data Manager (Tools > Historical Data Manager) for the instrument and period you are testing the strategy on?

    Comment


      #3
      Hello, thanks for the reply. So I found the section an line you were referring to. I have posted it below. I am fairly new, so how would I change it to enable back-testing.

      #region OnBarUpdate
      protected override void OnBarUpdate()
      {
      if (Historical && !HistoryVal) return;

      Thanks!

      Comment


        #4
        Hello Corbett,

        Thank you for your response.

        Comment out those lines with //.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        635 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        365 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        106 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        567 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        571 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X