• 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

Ninjatrader Exception output

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

    Ninjatrader Exception output

    Hi Ninjatrader,

    I am successfully catching an exception within an indicator script and dealing with them, but I am still seeing the exception written to the output window.

    Are exceptions, regardless of try{catch} written to the output window internally even though the exception was caught?

    I ask in case there is another exception that I am not aware of and if so, this would save me some diagnostic time.

    Thank you for any help

    Number1

    #2
    Hello Number1,

    The exception that NinjaTrader is displaying should be the same exception message that you are catching.

    What exception message are you getting so that I may try to assist you?
    JCNinjaTrader Customer Service

    Comment


      #3
      Hi JC,

      Yes, the exception is the same (the dreaded index is out of range execption for a multiple-instrument intraday bar chart).

      However, I have narrowed it down. The exception is occurring prior to my Try{catch} when the indicator is trying to access the Times[] array/list and thus the exception written was not the one being caught but before the try{catch}. I never imagined that the Times[][0] could not exist on an OnBarUpdate event. That is crazy as one would think the Time[] would exist for the instrument if the instrument trades. Perhaps, the OnBarUpdate is receiving price data ahead of that Time[] array creation?

      This only happens on the opening session. I guess I need to check for Times[][0] existence?

      Thanks for your input.

      Number1
      Last edited by number1; 04-24-2014, 11:08 AM.

      Comment


        #4
        Hello Number1,

        The Times[][] object will be created when the OnBarUpdate() event for that series is called.

        You may just use the CurrentBars[] to check see if the objects (including the Times[][]) have been created before you access them.

        For example:

        if (CurrentBars[0] < BarsRequired || CurrentBars[1] < BarsRequired)
        return;

        http://www.ninjatrader.com/support/h...urrentbars.htm
        JCNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Tradarr, Today, 06:25 PM
        2 responses
        6 views
        0 likes
        Last Post Tradarr
        by Tradarr
         
        Started by cocopod, Today, 04:47 PM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_JoshG  
        Started by digibob, Today, 02:47 AM
        2 responses
        14 views
        0 likes
        Last Post NinjaTrader_Kate  
        Started by mntemel, Today, 03:31 PM
        4 responses
        21 views
        0 likes
        Last Post mntemel
        by mntemel
         
        Started by mrlucky1x, Today, 03:14 PM
        2 responses
        7 views
        0 likes
        Last Post mrlucky1x  
        Working...
        X