using NinjaTrader.Gui;
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace NinjaTrader.NinjaScript.Indicators.Samples
{
public class SampleExpandableObjectIndicator : Indicator
{
[TypeConverter(typeof(ExpandableObjectConverter))]
public class MyObject : NotifyPropertyChangedBase, ICloneable
{
public bool Boolean { get; set; }
public int Number { get; set; }
public string Text { get; set; }
public MyObject() : this(true, 256, "Hello World!") { }
public MyObject(bool boolean, int number, string text)
{
Boolean = boolean;
Number = number;
Text = text;
}
public object Clone()
{
return new MyObject(Boolean, Number, Text);
}
public override string ToString()
{
return string.Format("{0}, {1}, {2}", Boolean, Number, Text);
}
}
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Name = "Expandable Object";
Object = new MyObject();
}
}
[Display(Name = "My object")]
public MyObject Object { get; set; }
}
}
Plot (updates the text when property changed)

Comment