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 chbruno, Today, 04:10 PM
      0 responses
      3 views
      0 likes
      Last Post chbruno
      by chbruno
       
      Started by josh18955, 03-25-2023, 11:16 AM
      6 responses
      436 views
      0 likes
      Last Post Delerium  
      Started by FAQtrader, Today, 03:35 PM
      0 responses
      6 views
      0 likes
      Last Post FAQtrader  
      Started by rocketman7, Today, 09:41 AM
      5 responses
      19 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by frslvr, 04-11-2024, 07:26 AM
      9 responses
      127 views
      1 like
      Last Post caryc123  
      Working...
      X