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 FrancisMorro, Today, 03:24 AM
        0 responses
        1 view
        0 likes
        Last Post FrancisMorro  
        Started by Segwin, 05-07-2018, 02:15 PM
        10 responses
        1,770 views
        0 likes
        Last Post Leafcutter  
        Started by Rapine Heihei, 04-23-2024, 07:51 PM
        2 responses
        31 views
        0 likes
        Last Post Max238
        by Max238
         
        Started by Shansen, 08-30-2019, 10:18 PM
        24 responses
        944 views
        0 likes
        Last Post spwizard  
        Started by Max238, Today, 01:28 AM
        0 responses
        11 views
        0 likes
        Last Post Max238
        by Max238
         
        Working...
        X