namespace NinjaTrader.NinjaScript.Indicators { public class AttributeTest : Indicator { public class Symbol{ public Symbol(string ticker,int labelTextAdjustment){ Ticker = ticker; LabelTextAdjustment = labelTextAdjustment; } public string Ticker {get; set;} [Display(Name = "Draw Label", Order = 1, GroupName = Ticker)] public bool DrawLabel { get; set; } [Range(-2, 4)] [Display(Name="Label Text Adjustment", Order=2, GroupName=Ticker)] public int LabelTextAdjustment { get; set; } } public Dictionary<string, Symbol> symbols = new Dictionary<string, Symbol>(); protected override void OnStateChange() { if (State == State.SetDefaults) { Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionBuySellVolume; Name = "AttributeTest"; Calculate = Calculate.OnEachTick; } else if (State == State.Configure) { string[] values = Symbols.Split(','); //for each ticker the user gave, create a class for it and add the data series foreach (string ticker in values) { ticker.Trim(); AddDataSeries(ticker,BarsPeriodType.Minute,1); symbols.Add(ticker,new Symbol(ticker,2)); } } } #region Properties [NinjaScriptProperty] [Display(Name="Symbols(comma separated)", Description="Comma Separated Symbols List", Order=0, GroupName="Parameters")] public string Symbols { get; set; } #endregion } }
An object reference is required for the non-static field, method, or property.
[Display(Name = "Draw Label", Order = 1, GroupName = Ticker)]
[Display(Name="Label Text Adjustment", Order=2, GroupName=Ticker)]
Comment