Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

backtesting strategy with multiple bars does not run

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

    backtesting strategy with multiple bars does not run

    I'm using IQFeed for historical data and am creating a strategy using multiple time frames.

    If I add ANY period other than the default bar, the script never runs.

    For example, I run the script below with data type set to Tick. It never runs. Remove the add or change it to PeriodType.Tick and it works.

    Code:
    protected override void Initialize()
    {
      Add(PeriodType.Day, 1);
    }
    
    protected override void OnBarUpdate()
    {
      Print("hello world");
    }

    #2
    We'll follow up shortly.

    Comment


      #3
      Hi j0dan,

      By default, strategies require a minimum of 20 bars. When you add a daily bar series to your strategy that bar series requires 20 days of data before your strategy will run.

      When you open a chart the default is usually 15 days. This is not enough to suffice the 20 days. You will need to bump the "Days Back" value to something higher than 20. Please bear in mind that simply using 20 is not enough here since weekends do not count towards the required days in your bar series. A safe number would be something like 40.
      Josh P.NinjaTrader Customer Service

      Comment


        #4
        Originally posted by Josh View Post
        By default, strategies require a minimum of 20 bars. When you add a daily bar series to your strategy that bar series requires 20 days of data before your strategy will run.
        Another strange problem solved. Thank-you!

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        649 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        370 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        109 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        574 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        576 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X