• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error on NT8 Startup: Unhandled exception: Object reference not set o an object

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

    Error on NT8 Startup: Unhandled exception: Object reference not set o an object

    Hello,
    I am getting error (see topic) when starting NT8

    Click image for larger version

Name:	exception.png
Views:	1
Size:	21.1 KB
ID:	1038336

    In log i find

    2018-11-03 15:51:14:876|3|4|Strategy '131269595': unable to deserialize user data: There was an error reflecting type 'NinjaTrader.NinjaScript.Strategies.Golem'.
    2018-11-03 15:51:14:952|0|4|Unhandled exception: Object reference not set to an instance of an object.

    I have object Golem - which is ninja strategy and
    Gadget - which si form looking like this:



    I moved all code about gadget from golem.cs to class Gadget and error started to show.
    I tried to do in golem.cs

    [XmlIgnore()]
    public Golemator.Golem.Gadget gadget = null;

    and in gadget.cs
    [XmlIgnore()]
    private NinjaTrader.NinjaScript.Strategies.Golem golemObj;

    but nothing helps. does anyone know, what happens with my code - what runs on startup? Because I can compile all classes and if I add strategy to chart no error or exception occurs.
    Have no idea how to track error. I use Visual Studio but do not know how to debug NT while starting up.

    Thanks Paul
    Attached Files

    #2
    Hello kujista,

    Thank you for your note.

    These errors almost always have to do with public variables that are not serialized and should be, or public variables that are being passed through the XML parser when they shouldn't be.

    Are you able to identify the lines of code throwing the issue by commenting out public variables (and associated code) and testing your script again?

    You may try adding [XmlIgnore()] above,

    public Golemator.Golem.Core.Enum_Golem_AcceptedPatterns AOSTrades
    public Golemator.Golem.Core.Enum_Golem_Mode AOSMode

    See,
    https://ninjatrader.com/support/help...eattribute.htm

    When you save an indicator to a chart either via a workspace file, or in a chart template, it saves all of the public properties from the indicator via an XML file.

    There are complex objects like Brushes, ChartObjects, or even .NET types like TimeSpan which cannot be serialized like a simple type of string or int, etc. These are just a few examples and you need to take precautions if you're using these publicly.

    When you add XmlIgnore you're telling the XML Serializer to skip that property and not save it into the workspace or template file.

    More information on this .NET concept can be found here:
    https://docs.microsoft.com/en-us/dot...ramework-4.7.2
    https://docs.microsoft.com/en-us/dot...ramework-4.7.2

    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by aligator, Today, 12:29 PM
    0 responses
    8 views
    0 likes
    Last Post aligator  
    Started by bob77713, Today, 11:30 AM
    0 responses
    0 views
    0 likes
    Last Post bob77713  
    Started by FMtrader, 03-15-2019, 02:30 AM
    6 responses
    38 views
    0 likes
    Last Post James108  
    Started by timko, Today, 08:18 AM
    0 responses
    2 views
    0 likes
    Last Post timko
    by timko
     
    Started by victorsmith, Today, 06:00 AM
    0 responses
    6 views
    0 likes
    Last Post victorsmith  
    Working...
    X