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 argusthome, Yesterday, 10:06 AM
            0 responses
            17 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            16 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            14 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            9 views
            0 likes
            Last Post TheRealMorford  
            Started by Mindset, 02-28-2026, 06:16 AM
            0 responses
            36 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X