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

Catching NinjaTrader internal exception

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

  • number1
    replied
    Chelsea,

    I will need some time to remove local objects and references that will cause the script to fail on your side. Please give me a few days! Thanks.


    Number1

    Leave a comment:


  • number1
    replied
    I understand. Sorry I specifically phrased it as "inside and enclosing" so that it would be perfectly clear and that I wasn't clueless with where to put try/catch statements.. Regardless, I am experienced with try/catch and exception handling so we can move on with that assumption.

    I will forward the indicator. Please confirm that you have real-time feed access to both CME GLOBEX and Kinetick exchanges, otherwise this is wasting both our time.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello number1,

    I was not trying to insult you.

    I was responding to this specific text
    Shouldn't that Try/Catch inside and enclosing OnBarUpdate catch the exception without flowing back to NinjaTrader?
    The enclosing here is what I am focusing on and just wanting to ensure that this is done correctly.

    Please send your script to platformsupport [at] ninjatrader [dot] com. In the email please include a link to this forum thread.

    Leave a comment:


  • number1
    replied
    Chelsea,

    Obviously the try/catch is inside the OnBarUpdate.... "inside and enclosing OnBarUpdate". I know you deal with inexperienced programmers... but please that's kind of an insult...


    I will email from outside. Thanks.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hi number1,

    The try and catch would need to be within the OnBarUpdate method, not containing it.

    May I test your script on my end?

    To export your script do the following:
    1. Click File -> Utilities -> Export NinjaScript
    2. Enter a unique name for the file in the value for 'File name:'
    3. Select the strategy from the objects list on the left -> click the right facing arrow ">" to add the strategy to the export
    4. Click the 'Export' button -> click 'yes' to add any referenced indicators to the export -> click OK to clear the export location message


    By default your exported file will be in the following location:
    • (My) Documents/NinjaTrader 7/bin/Custom/ExportNinjaScript/<export_file_name.zip>


    Below is a link to the help guide on Exporting NinjaScripts.
    http://www.ninjatrader.com/support/h...nt7/export.htm

    If you would like to keep the script private, please let me know and I will have you email this in to support.

    Leave a comment:


  • number1
    replied
    Chelsea,

    I tested and the exception is still occurring. I already place a Try/Catch in the OnBarUpdate catching the entire routine.

    Question: Shouldn't that Try/Catch inside and enclosing OnBarUpdate catch the exception without flowing back to NinjaTrader?


    The exception is occurring with a multi security Bar indicator using tick data.

    Thanks for researching.

    Number1

    Leave a comment:


  • number1
    replied
    Chelsea,

    Thank you. Let me add that and test on tomorrows open.

    Regards,

    Number1

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hi number1,

    Does adding a check for the CurrentBar being greater than one for any processing to happen correct the script?

    For example:

    if (CurrentBar < 1)
    return;


    The error is saying there is no data on the chart which causes an error with indexes.

    Leave a comment:


  • number1
    replied
    Chelsea,

    Thank you for getting back so quickly. No this exception only occurs before a bar has been created occurring a "moment" after the session starts.

    Number1

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hi number1,

    Thank you for your post.

    Are there any bars on the chart this indicator was added to?

    If you add this indicator to a chart with data does this error still occur?

    Leave a comment:


  • number1
    started a topic Catching NinjaTrader internal exception

    Catching NinjaTrader internal exception

    Hi NinjaTrader,

    I would like to catch this exception within my own indicator code vs allowing it to trace thru back to the NinjaTrader application. It is occurring from IndicatorBase which is in the "do not touch" portion of the indicator created code. Would it be OK for me to catch this in Indicator: IndicatorBase (a do not disturbe NinjaScript generated code) vs allowing it to go unhandled?

    2014-10-06 06:30:02:044 in OnUnhandledThreadException
    2014-10-06 06:30:02:185 *************** unhandled exception trapped ***************
    2014-10-06 06:30:02:185 Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index
    2014-10-06 06:30:02:185 at System.Collections.ArrayList.get_Item(Int32 index)
    at NinjaTrader.Data.MemBars.GetClose(Int32 index)
    at NinjaTrader.Data.Bars.GetClose(Int32 index)
    at NinjaTrader.Indicator.DataSeriesHelper.get_Item(In t32 barsAgo)
    at NinjaTrader.Indicator.IndicatorBase.Process(Object sender, BarUpdateEventArgs e)
    at NinjaTrader.Data.MarketDataEventArgs.Process()
    at NinjaTrader.Cbi.Connection.OnRealtimeDataTimerTick (Object sender, EventArgs e)
    at System.Windows.Forms.Timer.OnTick(EventArgs e)
    at System.Windows.Forms.Timer.TimerNativeWindow.WndPr oc(Message& m)
    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Latest Posts

Collapse

Topics Statistics Last Post
Started by cre8able, Today, 01:16 PM
2 responses
9 views
0 likes
Last Post cre8able  
Started by chbruno, 04-24-2024, 04:10 PM
3 responses
48 views
0 likes
Last Post NinjaTrader_Gaby  
Started by samish18, Today, 01:01 PM
1 response
7 views
0 likes
Last Post NinjaTrader_LuisH  
Started by WHICKED, Today, 12:56 PM
1 response
9 views
0 likes
Last Post NinjaTrader_Gaby  
Started by WHICKED, Today, 12:45 PM
1 response
11 views
0 likes
Last Post NinjaTrader_Gaby  
Working...
X