• 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

  • NinjaTrader_ChelseaB
    replied
    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.

    Leave a comment:


  • Gerik
    replied
    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

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    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?

    Leave a comment:


  • Gerik
    started a topic Error on executing DB command

    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

Latest Posts

Collapse

Topics Statistics Last Post
Started by horace chow, Today, 04:00 PM
3 responses
14 views
0 likes
Last Post bltdavid  
Started by PrimoItch, Today, 04:35 PM
0 responses
6 views
0 likes
Last Post PrimoItch  
Started by Serge A, Today, 04:03 PM
0 responses
9 views
0 likes
Last Post Serge A
by Serge A
 
Started by JBTrader2005, Today, 03:57 PM
0 responses
6 views
0 likes
Last Post JBTrader2005  
Started by Austiner87, Yesterday, 09:29 PM
1 response
18 views
0 likes
Last Post NinjaTrader_Kate  
Working...
X