Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SampleMultiInstrument

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

    SampleMultiInstrument

    Hi,
    I try to develop a multi instrument strategy (an indicator, in fact) but I am having the following problem that I don't understand :

    I modified SampleMultiInstrument strategy by doing the following :


    Code:
                if (BarsInProgress != 0)
                    return;
                tmp = ADX(BarsArray[1], 14)[0];
                // Checks if the 14 period ADX on both instruments are trending (above a value of 30)
                if (ADX(14)[0] > 30 && ADX(BarsArray[1], 14)[0] > 30)
    As you can see, I just added the tmp variable (defined as private double).

    This result in the "Error on calling 'OnBarUpdate' method fro strategy 'SampleMultiInstrument': ADX[barsAgo] out of valid range 0 through -1 was 0"

    PS1: I did other modifications : the contract is now "ES 06-09" with PeriodType.Second=30, and I renamed the indicator as the original is read only.
    PS2: If I comment the "tmp = ADX(BarsArray[1], 14)[0];" line, then I don't get the error

    Thank you for your help.
    Last edited by fle__; 05-28-2009, 06:20 AM.

    #2
    Please try adding the timeframes in ascending order, i.e. if you want to add a 30 second timeframes as second bars object, then let the primay be a smaller one i.e. 15 seconds.

    Comment


      #3
      Thanks for the quick reply.
      I will try it now.

      For the record, both timeframe were equal at 30 sec.

      Comment


        #4
        I've done the test, using 15sec for the primary data and 30 sec for the second.

        It does not change anything.

        Do you have another suggestion ?

        Thanks.

        Comment


          #5
          I tried reproducing this, too and it worked as expected on my end - can you please send me the exact code and setup you used to support at ninjatrader dot com Attn Bertrand, then I can take a look and review. Thanks!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          650 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          370 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          109 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          574 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          577 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X