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 Karado58, 11-26-2012, 02:57 PM
            8 responses
            14,828 views
            0 likes
            Last Post Option Whisperer  
            Started by Option Whisperer, Today, 09:05 AM
            0 responses
            1 view
            0 likes
            Last Post Option Whisperer  
            Started by cre8able, Yesterday, 01:16 PM
            3 responses
            11 views
            0 likes
            Last Post cre8able  
            Started by Harry, 05-02-2018, 01:54 PM
            10 responses
            3,204 views
            0 likes
            Last Post tharton3  
            Started by ChartTourist, Today, 08:22 AM
            0 responses
            6 views
            0 likes
            Last Post ChartTourist  
            Working...
            X