I have created the new indicator ,and compiled there is no error in the file but to apply this indicator to chart in the list my indicator is not showing, please see on code below.
#region Using declarations using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Input; using System.Windows.Media; using System.Xml.Serialization; using NinjaTrader.Cbi; using NinjaTrader.Gui; using NinjaTrader.Gui.Chart; using NinjaTrader.Gui.SuperDom; using NinjaTrader.Gui.Tools; using NinjaTrader.Data; using NinjaTrader.NinjaScript; using NinjaTrader.Core.FloatingPoint; using NinjaTrader.NinjaScript.DrawingTools; #endregion //This namespace holds Indicators in this folder and is required. Do not change it. namespace NinjaTrader.NinjaScript.Indicators { public class Tickreplay : Indicator { int alertBar; int PeriodType=10; int Minute; //AddPlot(Brushes.Orange, "SMA"); // Add (PeriodType.Minute, 10); protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"acessing the tick replay"; Name = "Tickreplay"; Calculate = Calculate.OnBarClose; IsOverlay = false; 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; Price = 14; Volume = 4; PeriodType = 10; int Minute=15; BarsRequiredToPlot = 10; // Do not plot until the 11th bar on the chart AddPlot(Brushes.Orange, "SMA"); //PaintPriceMarkers = true; // Indicator plots values display in the y-axis AddPlot(Brushes.Orange, "SMA"); //AddPlot (PeriodType.Minute, 10); double value = CurrentDayOHL().CurrentOpen[0]; //sAddPlot (PeriodType.Minute, 20); //CalculateOnBarClose = false; } else if (State == State.Configure) { AddDataSeries("ES 06-17", Data.BarsPeriodType.Tick, 1, Data.MarketDataType.Ask); AddDataSeries("ES 06-17", Data.BarsPeriodType.Minute, 1, Data.MarketDataType.Bid); } } protected override void OnMarketData(MarketDataEventArgs marketDataUpdate) { } protected override void OnBarUpdate() { //Add your custom indicator logic here. if (BarsInProgress != 0) // all series get the update so we'll use the original chart one only return; if ((int)(SMA(Closes[1],5)[0]) == (int)(SMA(Closes[2],10)[0])) { if (CurrentBar != alertBar) { // draw or make a sound here alertBar = CurrentBar; } } } #region Properties [NinjaScriptProperty] [Range(1, int.MaxValue)] [Display(Name="Price", Order=1, GroupName="Parameters")] public int Price { get; set; } [NinjaScriptProperty] [Range(1, int.MaxValue)] [Display(Name="Volume", Order=2, GroupName="Parameters")] public int Volume { get; set; } #endregion } } #region NinjaScript generated code. Neither change nor remove. namespace NinjaTrader.NinjaScript.Indicators { public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase { private Tickreplay[] cacheTickreplay; public Tickreplay Tickreplay(int price, int volume) { return Tickreplay(Input, price, volume); } public Tickreplay Tickreplay(ISeries<double> input, int price, int volume) { if (cacheTickreplay != null) for (int idx = 0; idx < cacheTickreplay.Length; idx++) if (cacheTickreplay[idx] != null && cacheTickreplay[idx].Price == price && cacheTickreplay[idx].Volume == volume && cacheTickreplay[idx].EqualsInput(input)) return cacheTickreplay[idx]; return CacheIndicator<Tickreplay>(new Tickreplay(){ Price = price, Volume = volume }, input, ref cacheTickreplay); } } } namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns { public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase { public Indicators.Tickreplay Tickreplay(int price, int volume) { return indicator.Tickreplay(Input, price, volume); } public Indicators.Tickreplay Tickreplay(ISeries<double> input , int price, int volume) { return indicator.Tickreplay(input, price, volume); } } } namespace NinjaTrader.NinjaScript.Strategies { public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase { public Indicators.Tickreplay Tickreplay(int price, int volume) { return indicator.Tickreplay(Input, price, volume); } public Indicators.Tickreplay Tickreplay(ISeries<double> input , int price, int volume) { return indicator.Tickreplay(input, price, volume); } } } #endregion
Comment