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

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.
    JesseNinjaTrader Customer Service

    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.
        JesseNinjaTrader Customer Service

        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 algospoke, Yesterday, 06:40 PM
            2 responses
            23 views
            0 likes
            Last Post algospoke  
            Started by ghoul, Today, 06:02 PM
            3 responses
            14 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by jeronymite, 04-12-2024, 04:26 PM
            3 responses
            45 views
            0 likes
            Last Post jeronymite  
            Started by Barry Milan, Yesterday, 10:35 PM
            7 responses
            22 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by AttiM, 02-14-2024, 05:20 PM
            10 responses
            181 views
            0 likes
            Last Post jeronymite  
            Working...
            X