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 MarianApalaghiei, Today, 10:49 PM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by love2code2trade, Yesterday, 01:45 PM
        4 responses
        28 views
        0 likes
        Last Post love2code2trade  
        Started by funk10101, Today, 09:43 PM
        0 responses
        8 views
        0 likes
        Last Post funk10101  
        Started by pkefal, 04-11-2024, 07:39 AM
        11 responses
        37 views
        0 likes
        Last Post jeronymite  
        Started by bill2023, Yesterday, 08:51 AM
        8 responses
        46 views
        0 likes
        Last Post bill2023  
        Working...
        X