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 pvincent, 06-23-2022, 12:53 PM
      14 responses
      238 views
      0 likes
      Last Post Nyman
      by Nyman
       
      Started by TraderG23, 12-08-2023, 07:56 AM
      9 responses
      383 views
      1 like
      Last Post Gavini
      by Gavini
       
      Started by oviejo, Today, 12:28 AM
      0 responses
      1 view
      0 likes
      Last Post oviejo
      by oviejo
       
      Started by pechtri, 06-22-2023, 02:31 AM
      10 responses
      125 views
      0 likes
      Last Post Leeroy_Jenkins  
      Started by judysamnt7, 03-13-2023, 09:11 AM
      4 responses
      59 views
      0 likes
      Last Post DynamicTest  
      Working...
      X