Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

error

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

    error

    any guidance is appreciated ... getting this error msg and don't know why:
    Error on executing DB command: System.InvalidOperationException: There was an error reflecting type 'NinjaTrader.NinjaScript.Strategies.MyNT8FractalLi mit'. ---> System.InvalidOperationException: Cannot serialize member 'NinjaTrader.NinjaScript.Strategies.MyNT8FractalLi mit.entryStopPrice' of type 'NinjaTrader.NinjaScript.Series`1[[System.Double, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]', see inner exception for more details. ---> System.InvalidOperationException: NinjaTrader.NinjaScript.Series`1[System.Double] 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.GetFieldModel (FieldInfo fieldInfo) 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 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()

    #2
    Hello pman777,

    The error seems to indicate that the strategy
    "MyNT8FractalLimit"
    cannot be saved
    "Cannot serialize"
    and is likely related to a public property:
    member 'NinjaTrader.NinjaScript.Strategies.MyNT8FractalLi mit.entryStopPrice' of type 'NinjaTrader.NinjaScript.Series`1[[System.Double
    Without seeing the code I could only guess that the problem deals with saving the script and a public property which is missing the [XmlIgnore] attribute where it is needed.




    I look forward to being of further assistance.

    Comment


      #3
      thanks Jesse ... will look into this and get back to you if I need further assistance. I do have another unrelated question though ... I have a range that I calculate and want to capture a breakout to the upside or downside of this range when price crosses, respectively, through the range. So I have a EnterLongStopLimit set for the upper boundary and EnterShortStopLimit for the lower boundary. But it seems, according to the Internal Order Handling Rules, I cannot have 2 positions opened in the opposite direction. Is there a way to accomplish this? Thanks again.

      Comment


        #4
        Hello pman777,

        Yes, you cannot have two positions in opposite directions as that would equal flat, or a number in one direction if the filled orders which created the position had different quantities. You can have two opposing orders open at once such as a long and short limit order but this cannot be done in the managed approach.

        The managed approach will keep you from doing this with the rules it has. To bracket orders, you would need to use the unmanaged approach.

        You can find an example of an unmanaged strategy that creates a bracket order here: https://ninjatrader.com/support/foru...ry-orders-help


        I look forward to being of further assistance.

        Comment


          #5
          thank you!

          Comment


            #6
            Originally posted by NinjaTrader_Jesse View Post
            Hello pman777,

            Yes, you cannot have two positions in opposite directions as that would equal flat, or a number in one direction if the filled orders which created the position had different quantities. You can have two opposing orders open at once such as a long and short limit order but this cannot be done in the managed approach.

            The managed approach will keep you from doing this with the rules it has. To bracket orders, you would need to use the unmanaged approach.

            You can find an example of an unmanaged strategy that creates a bracket order here: https://ninjatrader.com/support/foru...ry-orders-help


            I look forward to being of further assistance.


            But Unmanaged orders have some bad limitation
            For example, if you want to use Market orders and Calculate.OnBarClose you will get the order execution on the price of bar OPEN instead of bar CLOSE
            How to avoid this?

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Yesterday, 05:17 AM
            0 responses
            59 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            134 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            75 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            45 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            50 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X