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 Tim-c, Today, 10:58 AM
      0 responses
      1 view
      0 likes
      Last Post Tim-c
      by Tim-c
       
      Started by traderqz, Yesterday, 09:06 AM
      3 responses
      21 views
      0 likes
      Last Post NinjaTrader_ThomasC  
      Started by f.saeidi, Today, 10:19 AM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by kujista, Today, 06:23 AM
      5 responses
      18 views
      0 likes
      Last Post kujista
      by kujista
       
      Started by traderqz, Today, 12:06 AM
      3 responses
      6 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Working...
      X