• 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 executing DB command

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

    Error on executing DB command

    Hello,

    I receive the following error message with automation:

    Error on executing DB command: System.InvalidOperationException: There was an error reflecting type 'NinjaTrader.NinjaScript.Strategies.Testsystem'. ---> System.InvalidOperationException: There was an error reflecting field 'entryOrder'. ---> System.InvalidOperationException: There was an error reflecting type 'NinjaTrader.Cbi.Order'. ---> System.InvalidOperationException: There was an error reflecting property 'UserData'. ---> System.InvalidOperationException: There was an error reflecting type 'System.Xml.Linq.XDocument'. ---> System.InvalidOperationException: Cannot serialize member 'System.Xml.Linq.XDocument.Declaration' of type 'System.Xml.Linq.XDeclaration', see inner exception for more details. ---> System.InvalidOperationException: System.Xml.Linq.XDeclaration cannot be serialized because it does not have a parameterless constructor. --- End of inner exception stack trace --- at System.Xml.Serialization.StructModel.CheckSupporte dMember(TypeDesc typeDesc, MemberInfo member, Type type) at System.Xml.Serialization.StructModel.GetPropertyMo del(PropertyInfo propertyInfo) at System.Xml.Serialization.StructModel.GetFieldModel (MemberInfo memberInfo) at System.Xml.Serialization.XmlReflectionImporter.Ini tializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter) at System.Xml.Serialization.XmlReflectionImporter.Imp ortStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a, RecursionLimiter limiter) at System.Xml.Serialization.XmlReflectionImporter.Imp ortTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter) --- End of inner exception stack trace --- at System.Xml.Serialization.XmlReflectionImporter.Imp ortTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter) at System.Xml.Serialization.XmlReflectionImporter.Imp ortAccessorMapping(MemberMapping accessor, FieldModel model, XmlAttributes a, String ns, Type choiceIdentifierType, Boolean rpc, Boolean openModel, RecursionLimiter limiter) at System.Xml.Serialization.XmlReflectionImporter.Imp ortFieldMapping(StructModel parent, FieldModel model, XmlAttributes a, String ns, RecursionLimiter limiter) at System.Xml.Serialization.XmlReflectionImporter.Ini tializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter) --- End of inner exception stack trace --- at System.Xml.Serialization.XmlReflectionImporter.Ini tializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter) at System.Xml.Serialization.XmlReflectionImporter.Imp ortStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a, RecursionLimiter limiter) at System.Xml.Serialization.XmlReflectionImporter.Imp ortTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter) --- End of inner exception stack trace --- at System.Xml.Serialization.XmlReflectionImporter.Imp ortTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter) at System.Xml.Serialization.XmlReflectionImporter.Imp ortAccessorMapping(MemberMapping accessor, FieldModel model, XmlAttributes a, String ns, Type choiceIdentifierType, Boolean rpc, Boolean openModel, RecursionLimiter limiter) at System.Xml.Serialization.XmlReflectionImporter.Imp ortFieldMapping(StructModel parent, FieldModel model, XmlAttributes a, String ns, RecursionLimiter limiter) at System.Xml.Serialization.XmlReflectionImporter.Ini tializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter) --- End of inner exception stack trace --- at System.Xml.Serialization.XmlReflectionImporter.Ini tializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter) at System.Xml.Serialization.XmlReflectionImporter.Imp ortStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a, RecursionLimiter limiter) at System.Xml.Serialization.XmlReflectionImporter.Imp ortTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter) --- End of inner exception stack trace --- at System.Xml.Serialization.XmlReflectionImporter.Imp ortTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter) at System.Xml.Serialization.XmlReflectionImporter.Imp ortElement(TypeModel model, XmlRootAttribute root, String defaultNamespace, RecursionLimiter limiter) at System.Xml.Serialization.XmlReflectionImporter.Imp ortTypeMapping(Type type, XmlRootAttribute root, String defaultNamespace) at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace) at NinjaTrader.NinjaScript.StrategyBase.ToXml() at NinjaTrader.NinjaScript.StrategyBase.DbAdd() at NinjaTrader.NinjaScript.StrategyBase.DbUpdate() at NinjaTrader.Cbi.DB.DBThread().

    Any idea why I get this error message? Unfortunately NinjaTrader does not indicate the line in the code where the error has occured.

    Gerik

    #2
    Hello Gerik,

    Is this error occurring when placing an order?

    If so, please try recreating the database.

    To rename the database:
    • Shutdown NinjaTrader
    • Open the Documents > NinjaTrader 8 > db folder
    • Right click on NinjaTrader.sdf and select "Rename"
    • Rename the file 'OLDNinjaTrader.sdf'
    • Finally, restart NinjaTrader


    Or is this error occurring when running a specific strategy?

    If so, does this error occur when testing the Sample MA Crossover included with NinjaTrader?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello Chelsea,

      I have renamed the database. Same issue.

      "private Order entryOrder" was defined as "public Order entryOrder" in the class of my strategy.

      This caused the issue.

      Thank you
      Gerik

      Comment


        #4
        Hello Gerik,

        Thank you for confirming this is coming from a NinjaScript Strategy.

        Yes, Order objects will need to be private.

        Below is a link to the help guide on Order which has example code.
        https://ninjatrader.com/support/help.../nt8/order.htm


        If the error is not occurring when placing an order, and is coming from a NinjaScript Strategy, renaming the database will have no effect as the error is being caused by running a strategy.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by junposlee, 03-29-2020, 11:21 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_SergeyS  
        Started by Darylbe, 03-29-2020, 11:51 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_RyanS  
        Started by futurestrader7, Today, 04:21 AM
        3 responses
        15 views
        0 likes
        Last Post bltdavid  
        Started by KJenkins56, Today, 05:21 AM
        0 responses
        6 views
        0 likes
        Last Post KJenkins56  
        Started by elvapope5, Today, 04:48 AM
        0 responses
        7 views
        0 likes
        Last Post elvapope5  
        Working...
        X