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 mattbsea, Today, 05:44 PM
        0 responses
        3 views
        0 likes
        Last Post mattbsea  
        Started by RideMe, 04-07-2024, 04:54 PM
        6 responses
        31 views
        0 likes
        Last Post RideMe
        by RideMe
         
        Started by tkaboris, Today, 05:13 PM
        0 responses
        2 views
        0 likes
        Last Post tkaboris  
        Started by GussJ, 03-04-2020, 03:11 PM
        16 responses
        3,282 views
        0 likes
        Last Post Leafcutter  
        Started by WHICKED, Today, 12:45 PM
        2 responses
        20 views
        0 likes
        Last Post WHICKED
        by WHICKED
         
        Working...
        X