Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Properties of type BarsPeriodType cannot be deserialized when using custom bar types

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

    Properties of type BarsPeriodType cannot be deserialized when using custom bar types

    Context: NT8 Beta 6

    If the value of a property which should be serializable has a value specifying a custom bar type, it cannot be deserialized. So when attempting to load a template or workspace which has an indicator or strategy with such a property, the indicator is removed from the chart, with no warming except a log entry (most users would have no idea what was wrong.)

    I've attached a log file showing the log entry.

    One solution is to define an associated serialization property, and attach the XmlIgnore attribute to the property itself.

    However, this either needs to be much better documented, or some other solution for custom bar types needs to be implemented. Perhaps one of the following:

    1) Use strings (names) to identify bar types, not enumeration constants. This would have other major benefits. Some examples: Better avoidance of identity key clashes between multiple providers of custom bar types; making it easier to specify custom bar types as the value of an indicator or strategy property.

    2) Use integers to identify bar types, not an enumeration type; provide a function which maps between integer codes and bar type names, including those for custom bar types; and provide a way to select defined bar types by name from a list in property dialogs.

    3) Globally handle the serialization of properties of type BarsPeriodType specially, so that custom coders don't have to be concerned with the issue.
    Attached Files
    Last edited by strategesis; 10-26-2015, 09:24 PM.

    #2
    Hello strategesis,

    Thank you for your inquiry.

    I am unable to reproduce this on my end.

    For further clarification, can you please provide a sample script that demonstrates this issue?
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      Simple example

      I've attached a simple indicator which can be used to reproduce the problem.

      Note: To reproduce the problem the indicator must be added to a chart which is using a custom bar type as its main data series.

      Also, the exception will be raised when simply adding the indicator to a chart (whose bar type is custom) if the [NinjaScriptProperty] attribute is defined for the property (that attribute is commented out in the attached code.)

      And finally, the problem will vanish if the [XmlIgnore] attribute is defined for the property (but not if the [NinjaScriptProperty] attribute is also defined.)
      Attached Files
      Last edited by strategesis; 10-27-2015, 06:16 PM.

      Comment


        #4
        Zachary,

        Have you been able to reproduce the problem?

        Comment


          #5
          Hello strategesis,

          Thank you for your patience.

          I am able to reproduce this issue on my end and will be submitting this to development.
          Zachary G.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by kulwinder73, Today, 10:31 AM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by RookieTrader, Today, 09:37 AM
          3 responses
          15 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by terofs, Yesterday, 04:18 PM
          1 response
          24 views
          0 likes
          Last Post terofs
          by terofs
           
          Started by CommonWhale, Today, 09:55 AM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by Gerik, Today, 09:40 AM
          2 responses
          8 views
          0 likes
          Last Post Gerik
          by Gerik
           
          Working...
          X