Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi Instrument Backtest

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

    Multi Instrument Backtest

    I have built a strategy with the sample code in the Multi-Time Frame and Instruments section of the Help guide. When I run this code in Strategy Analyzer and look at the results in Summary, Executions and Trades sections I only see trades and summary results for the primary instrument. The trades for the secondary instrument, in this case Apple, don't seem to show up.

    Have I made an error in my code or is there some other problem? My code is shown below.

    protectedoverridevoid Initialize()
    {
    Add(PeriodType.Minute,
    3);
    Add(
    "AAPL", PeriodType.Minute, 1);
    }
    protectedoverridevoid OnBarUpdate()
    {
    if (CurrentBars[0] <= BarsRequired || CurrentBars[1] <= BarsRequired || CurrentBars[2] <= BarsRequired)
    return;
    if (BarsInProgress == 0)
    {
    EnterLong();
    }
    if (BarsInProgress == 2)
    {
    EnterLong();
    EnterLong(0, 100, "BUY MSFT");

    #2
    I think I figured out my problem. I had the entries per direction set to 1. When I increase this value, I start to see the other trades from the secondary insturment.

    Comment


      #3
      Hello,

      Thanks for the update - that would likely be the case. As long as you're using the correct BarsArrayIndex in your entry methods, the orders should processed to that series.
      MatthewNinjaTrader Product Management

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      95 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      50 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      31 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      35 views
      0 likes
      Last Post TheRealMorford  
      Started by Mindset, 02-28-2026, 06:16 AM
      0 responses
      72 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X