I have this simple code:
protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Enter the description for your new custom Indicator here."; Name = "TheStratTFC"; Calculate = Calculate.OnPriceChange; IsOverlay = true; DisplayInDataBox = true; DrawOnPricePanel = true; DrawHorizontalGridLines = true; DrawVerticalGridLines = true; PaintPriceMarkers = true; ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right; //Disable this property if your indicator requires custom values that cumulate with each new market data event. //See Help Guide for additional information. IsSuspendedWhileInactive = true; } else if (State == State.Configure) { AddDataSeries(Data.BarsPeriodType.Month, 1); AddDataSeries(Data.BarsPeriodType.Week, 1); AddDataSeries(Data.BarsPeriodType.Day, 1); AddDataSeries(Data.BarsPeriodType.Minute, 240); AddDataSeries(Data.BarsPeriodType.Minute, 60); AddDataSeries(Data.BarsPeriodType.Minute, 30); } } protected override void OnBarUpdate() { if (BarsInProgress == 0) { Print("Month: " + MonthOpen + " Week:" + WeekOpen + " Day:" + DayOpen +" 4 Hour: "+Hour4+" Hour:"+Hour+" 30 min:"+Minute30); } if (BarsInProgress == 1)//Month { MonthOpen = Opens[1][0]; } if (BarsInProgress == 2)//Week { //WeekOpen = BarsArray[2].GetOpen(BarsArray[2].Count - 1); WeekOpen = Opens[2][0]; } if (BarsInProgress == 3)//Day { DayOpen = Opens[3][0]; } if (BarsInProgress == 4)//4 Hour { Hour4 = Opens[4][0]; } if (BarsInProgress == 5)//Hour { Hour = Opens[5][0]; } if (BarsInProgress == 6)//Minute 30 { Minute30 = Opens[6][0]; } }
Best Regards,
Sune
Comment