Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

B8 Import Fails when Stroke or DateTime properties are used

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

    B8 Import Fails when Stroke or DateTime properties are used

    To repro:

    1) Add the attached script to the Indicators folder. Compile, then add to a chart. Notice the DateTime and Stroke properties appear and work fine in properties window.

    2) Export the attached script as a compiled assembly.

    3) Import the exported .zip on another machine. The following compile errors will be logged (several times), preventing the assembly from being imported:

    The type or namespace name 'Stroke' could not be found (are you missing a using directive or an assembly reference?)

    The type or namespace name 'DateTime' could not be found (are you missing a using directive or an assembly reference?)
    Attached Files

    #2
    Hello RanchoDinero,

    Thank you for writing in.

    Please note that only types that can be Xml Serialized should be marked as a NinjaScriptProperty. Both Stroke and DateTime cannot be serialized.

    Please take a look at the NinjaTrader 8 help guide at this link for more information about the NinjaScriptProperty attribute: http://ninjatrader.com/support/helpG...yattribute.htm

    As an example for the BrokenDate DateTime property to work properly:
    Code:
    [XmlIgnore]
    [Browsable(false)]
    public DateTime BrokenDate
    { get; set; }
    
    [NinjaScriptProperty]
    [Display(Name="", Order=1, GroupName="General", Description="")]
    public string BrokenDateSerialize
    {
         get { return BrokenDate.ToString(); }
         set { BrokenDate = DateTime.Parse(value); }
    }
    Please, let us know if we may be of further assistance.
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      Does doing this resolve the export/import issue?

      Also, it would be fantastic to have an actual list of types which need to be serialized in this way. Or a list of types which don't. Either way.
      Last edited by RanchoDinero; 01-27-2016, 02:21 PM.

      Comment


        #4
        Hello RanchoDinero,

        Yes, once I have used a simple type as the NinjaScriptProperty against types which cannot be serialized, such as the DateTime example provided, I was able to both export and import the script.
        Zachary G.NinjaTrader Customer Service

        Comment


          #5
          Gotcha. Thanks. That list I mentioned would be fantastic for the help file. How to know otherwise?

          Comment


            #6
            Hello RanchoDinero,

            Unfortunately, this isn't a simple question to answer.

            If it is not a value type, or a simple object/struct, it probably cannot be serialized.

            I would suggest taking a look at this MSDN article for more information about this: https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx
            Zachary G.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by wzgy0920, 04-20-2024, 06:09 PM
            2 responses
            27 views
            0 likes
            Last Post wzgy0920  
            Started by wzgy0920, 02-22-2024, 01:11 AM
            5 responses
            32 views
            0 likes
            Last Post wzgy0920  
            Started by wzgy0920, 04-23-2024, 09:53 PM
            2 responses
            49 views
            0 likes
            Last Post wzgy0920  
            Started by Kensonprib, 04-28-2021, 10:11 AM
            5 responses
            193 views
            0 likes
            Last Post Hasadafa  
            Started by GussJ, 03-04-2020, 03:11 PM
            11 responses
            3,235 views
            0 likes
            Last Post xiinteractive  
            Working...
            X