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 Uregon, Today, 12:12 PM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_Kate  
      Started by kerplunk1899, Today, 10:03 AM
      1 response
      16 views
      0 likes
      Last Post NinjaTrader_Kate  
      Started by rexsole, Today, 10:20 AM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_RyanS  
      Started by pjsmith, Today, 03:01 AM
      6 responses
      17 views
      0 likes
      Last Post bltdavid  
      Started by algoroman, Today, 07:40 AM
      1 response
      25 views
      0 likes
      Last Post NinjaTrader_Jim  
      Working...
      X