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 AlessioCianini12, Today, 01:38 AM
      0 responses
      21 views
      0 likes
      Last Post AlessioCianini12  
      Started by nandhumca, Yesterday, 11:54 PM
      0 responses
      24 views
      0 likes
      Last Post nandhumca  
      Started by nandhumca, Yesterday, 11:51 PM
      0 responses
      23 views
      0 likes
      Last Post nandhumca  
      Started by ezrollin, Yesterday, 11:48 PM
      2 responses
      23 views
      0 likes
      Last Post ezrollin  
      Started by jjanguda, Yesterday, 10:15 PM
      1 response
      23 views
      0 likes
      Last Post NinjaTrader_ChrisSch  
      Working...
      X