Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    BertrandNinjaTrader Customer Service

    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!
          BertrandNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by cyberpete76, 03-27-2023, 12:29 AM
          7 responses
          265 views
          1 like
          Last Post slightly  
          Started by renewsaltwater, Today, 01:15 AM
          0 responses
          2 views
          0 likes
          Last Post renewsaltwater  
          Started by slightly, Today, 12:49 AM
          0 responses
          3 views
          0 likes
          Last Post slightly  
          Started by sdauteuil, 09-23-2021, 10:16 AM
          4 responses
          1,209 views
          0 likes
          Last Post jacobpescaia44  
          Started by agclub, 04-21-2024, 08:57 PM
          5 responses
          36 views
          0 likes
          Last Post agclub
          by agclub
           
          Working...
          X