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 cmoran13, Yesterday, 01:02 PM
          0 responses
          29 views
          0 likes
          Last Post cmoran13  
          Started by PaulMohn, 04-10-2026, 11:11 AM
          0 responses
          21 views
          0 likes
          Last Post PaulMohn  
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          160 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          95 views
          1 like
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          148 views
          2 likes
          Last Post CaptainJack  
          Working...
          X