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

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;

        JCNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by jpapa, Today, 07:22 AM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by kevinenergy, 02-17-2023, 12:42 PM
        116 responses
        2,758 views
        1 like
        Last Post kevinenergy  
        Started by franatas, 12-04-2023, 03:43 AM
        7 responses
        106 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by Jltarrau, Today, 05:57 AM
        3 responses
        9 views
        0 likes
        Last Post Jltarrau  
        Started by f.saeidi, Today, 05:56 AM
        2 responses
        9 views
        0 likes
        Last Post NinjaTrader_Erick  
        Working...
        X