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 jaybedreamin, Today, 05:56 PM
      0 responses
      3 views
      0 likes
      Last Post jaybedreamin  
      Started by DJ888, 04-16-2024, 06:09 PM
      6 responses
      18 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by Jon17, Today, 04:33 PM
      0 responses
      1 view
      0 likes
      Last Post Jon17
      by Jon17
       
      Started by Javierw.ok, Today, 04:12 PM
      0 responses
      6 views
      0 likes
      Last Post Javierw.ok  
      Started by timmbbo, Today, 08:59 AM
      2 responses
      10 views
      0 likes
      Last Post bltdavid  
      Working...
      X