• 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 Bionian, Today, 10:10 AM
      2 responses
      17 views
      0 likes
      Last Post NinjaTrader_ShawnB  
      Started by D Trader, Today, 01:41 PM
      0 responses
      8 views
      0 likes
      Last Post D Trader  
      Started by rexmie888, Today, 04:00 AM
      1 response
      9 views
      0 likes
      Last Post NinjaTrader_ShawnB  
      Started by terminatorT1000, Today, 01:23 AM
      1 response
      13 views
      0 likes
      Last Post NinjaTrader_ShawnB  
      Started by Tradarr, Today, 12:25 PM
      0 responses
      8 views
      0 likes
      Last Post Tradarr
      by Tradarr
       
      Working...
      X