Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Vix

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

    Vix

    Hello,

    my scripts are working OK, but as soon as I add VIX I have the error message
    "7/7/2016 9:54:40 PM Strategy Error on calling 'OnBarUpdate' method for strategy 'a111xESxSxTlevelxVix/733b05791f3d4803b465f42df8e50d84': You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart. "

    I do in Initialize
    Add( "^VIX", PeriodType.Range,2); // dataseries 4

    and I do in OnBarUpdate
    if(Lows[4][0] <= Instrument.MasterInstrument.Round2TickSize(Donchia nChannel(BarsArray[4],21).Lower[0]))

    When I remove the lines concerning VIX I have no message in logtab.

    Thank you!
    Tony
    Last edited by tonynt; 07-07-2016, 02:02 PM. Reason: clearifying

    #2
    Hello tonynt,

    Thank you for writing in.

    Please ensure that you have enough bars in the data series you are attempting to access before accessing it: http://ninjatrader.com/support/forum...ead.php?t=3170

    Additionally, please ensure that your added ^VIX series is, indeed, at BarsArray[4]. Remember when you are adding additional series to your script, the primary instrument is 0, the first added instrument 1, the second 2, so on and so forth.
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      Hello,

      thank you for your reply. There are enough bars (range 2 bars) after 4 hours.

      And I have

      //Add(PeriodType.Tick, 89);
      Add(PeriodType.Custom8,144002);//1
      //Add(PeriodType.Custom8,144001);//1
      Add(PeriodType.Range,2);//2
      //Add(PeriodType.Custom8,233002);//1
      Add(PeriodType.Range,3);//2
      Add( "^VIX", PeriodType.Range,2);
      Add( "^VIX", PeriodType.Range,1);

      So, I do not see an error referring your reply (I checked the code for what you replied already before doing the question)

      Thanks
      Tony

      Comment


        #4
        Hello tonynt,

        Please provide a simplified sample script demonstrating this error so I may test it on my end.

        To export your script do the following:
        1. Click File -> Utilities -> Export NinjaScript
        2. Enter a unique name for the file in the value for 'File name:'
        3. Select the strategy from the objects list on the left -> click the right facing arrow ">" to add the strategy to the export
        4. Click the 'Export' button -> click 'yes' to add any referenced indicators to the export -> click OK to clear the export location message


        By default your exported file will be in the following location:
        • (My) Documents/NinjaTrader 7/bin/Custom/ExportNinjaScript/<export_file_name.zip>


        Below is a link to the help guide on Exporting NinjaScripts.
        http://www.ninjatrader.com/support/h...nt7/export.htm
        Zachary G.NinjaTrader Customer Service

        Comment


          #5
          Hello,

          I worked a lot on this in the meantime and I found out that the reason for the issue is the instrument.

          My script works OK and there is no error-message in logtab when I add as 5th dataseries any instrument or "$USOIL".

          I keep all same in script and simply change the 5th dataseries "$USOIL" to "^VIX" then there appears immediately after enabling the script:

          10/4/2016 3:06:33 PM Strategy Error on calling 'OnMarketData' method for strategy 'tka1F5/6cd69507b817488c88d13a4bfc0b495b': You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.



          Thanks
          Tony
          Last edited by tonynt; 10-04-2016, 01:11 PM. Reason: clearifying, translation error

          Comment


            #6
            Hello tonynt,

            Thanks for your reply.

            Do you get a live chart of the ^VIX?

            If so, are you accessing the ^VIX during its normal operating times? (US Equities RTH).
            Paul H.NinjaTrader Customer Service

            Comment


              #7
              Hello,

              yes, live chart and during 8:30 AM - 3:30 PM

              Thank you for your support.

              Comment


                #8
                Hello tonynt,

                Thanks for your reply.

                Can you clarify what information that you are trying to obtain from the VIX index with OnMarketData? I suspect the issue is that it is an index that does not have volume or bid/ask data.
                Paul H.NinjaTrader Customer Service

                Comment


                  #9
                  Hello,

                  thank you for your reply. Close[0]>Open[0] is what I want to obtain from "^VIX".

                  Another information or question in this concern: why does it plot before 9:30?

                  You can jump on my PC to see that it is as I write, and that the y-value is the VIX.

                  Thanks
                  Tony

                  Comment


                    #10
                    Hello tonynt,

                    Please provide a simplified sample script demonstrating this error so I may test it on my end.

                    To export your script do the following:
                    Click File -> Utilities -> Export NinjaScript
                    Enter a unique name for the file in the value for 'File name:'
                    Select the strategy from the objects list on the left -> click the right facing arrow ">" to add the strategy to the export
                    Click the 'Export' button -> click 'yes' to add any referenced indicators to the export -> click OK to clear the export location message

                    By default your exported file will be in the following location:
                    (My) Documents/NinjaTrader 7/bin/Custom/ExportNinjaScript/<export_file_name.zip>

                    Below is a link to the help guide on Exporting NinjaScripts.


                    Please send to PlatformSupport[at]NinjaTrader[dot]com, atten Paul and a link to this thread. Also, please advise who is your datafeed provider.
                    Paul H.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by TheWhiteDragon, 01-21-2019, 12:44 PM
                    5 responses
                    551 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by rtwave, 04-12-2024, 09:30 AM
                    5 responses
                    37 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by funk10101, Today, 12:02 AM
                    1 response
                    11 views
                    0 likes
                    Last Post NinjaTrader_LuisH  
                    Started by GLFX005, Today, 03:23 AM
                    1 response
                    6 views
                    0 likes
                    Last Post NinjaTrader_Erick  
                    Started by nandhumca, Yesterday, 03:41 PM
                    1 response
                    13 views
                    0 likes
                    Last Post NinjaTrader_Gaby  
                    Working...
                    X