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

How can I serialize PeriodType

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

    How can I serialize PeriodType

    For Color I got this example from one of the forum threads:

    [XmlIgnore()]
    [Description("Up signal color")]
    [GridCategory(
    "Colors")]
    [Gui.Design.DisplayNameAttribute(
    "Up Signal Color")]
    public Color Uparrowcolor
    {
    get { return uparrowcolor; }
    set { uparrowcolor = value; }
    }

    [Browsable(false)]
    publicstring UparrowcolorSerialize
    {
    get { return NinjaTrader.Gui.Design.SerializableColor.ToString( uparrowcolor); }
    set { uparrowcolor = NinjaTrader.Gui.Design.SerializableColor.FromStrin g(value); }
    }




    What is availale to serialize PeriodType?

    I tried:

    [XmlIgnore()]
    [Description("The type of price data, typically set this to the same as the chart")]
    [GridCategory(
    "Price Data")]
    [Gui.Design.DisplayNameAttribute(
    "Price Type")]
    public PeriodType PriceDataType0
    {
    get { return priceDataType; }
    set { priceDataType = value; }

    }

    [Browsable(false)]
    publicstring PriceDataType0Serialize
    {
    get { return NinjaTrader.Gui.Design.SerializablePeriodType.ToSt ring(priceDataType); }
    set { priceDataType = NinjaTrader.Gui.Design.SerializablePeriodType.From String(value); }
    }



    but NinjaTrader.Gui.Design.SerializablePeriodType.From String
    does not exist.





    #2
    I figured it out... I found another link in the forum that illustrated this.... changed 2 things

    1.) Changed definition from

    PeriodType priceDataType= PeriodType.Minute;

    to

    private PeriodType priceDataType= PeriodType.Minute;

    (I think this was the key, now it's just like any other input parameter)

    2.) Change properties area as follows: (same as standard input parameter)

    [Description("The type of price data, typically set this to the same as the chart")]
    [GridCategory("Price Data")]
    [Gui.Design.DisplayNameAttribute("Price Type")]
    public PeriodType PriceDataType0
    {
    get { return priceDataType; }
    set { priceDataType = value; }
    }

    Comment


      #3
      Glad you could resolve it and thanks for sharing your solution here.
      BertrandNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by buytrueketo, Today, 02:14 AM
      0 responses
      6 views
      0 likes
      Last Post buytrueketo  
      Started by buytrueketo, Today, 02:13 AM
      0 responses
      8 views
      0 likes
      Last Post buytrueketo  
      Started by parkinsonbr, Today, 02:04 AM
      0 responses
      9 views
      0 likes
      Last Post parkinsonbr  
      Started by trueketo, Today, 01:00 AM
      0 responses
      12 views
      0 likes
      Last Post trueketo  
      Started by trueketo, Today, 12:59 AM
      0 responses
      13 views
      0 likes
      Last Post trueketo  
      Working...
      X