• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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 aviat72, Today, 12:41 AM
      1 response
      9 views
      0 likes
      Last Post NinjaTrader_ChrisSch  
      Started by _Zero_, 01-06-2020, 01:16 PM
      2 responses
      77 views
      2 likes
      Last Post CiprianV  
      Started by RuthB, 05-29-2020, 09:41 PM
      3 responses
      33 views
      0 likes
      Last Post aviat72
      by aviat72
       
      Started by Jorge.andres.o, Yesterday, 08:22 PM
      0 responses
      7 views
      0 likes
      Last Post Jorge.andres.o  
      Started by mtamaku, Yesterday, 06:54 PM
      0 responses
      12 views
      0 likes
      Last Post mtamaku
      by mtamaku
       
      Working...
      X