NinjaScript File Error Code Line Column MyCustomIndicator1.cs
The type or namespace name 'Ticker' could not be found (are you missing a using directive or an assembly reference?) CS0246 28 17
#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 namespace NinjaTrader.NinjaScript.Indicators { public class QQQToNQ : Indicator { private Ticker qqqTicker; private double diff; private SMA line_lpt1; private SMA line_lpt2; private SMA line_lpt3; private SMA line_lpt4; private SMA line_lpt5; private SMA line_spt1; private SMA line_spt2; private SMA line_spt3; private SMA line_spt4; private SMA line_spt5; protected override void OnStateChange() { if (State == State.SetDefaults) { Description = "This indicator converts QQQ price targets to NQ."; Name = "QQQ to NQ"; Overlay = true; input_date = ""; input_smoothing = 25; input_line_lpt1 = 0.0; input_line_lpt2 = 0.0; input_line_lpt3 = 0.0; input_line_lpt4 = 0.0; input_line_lpt5 = 0.0; input_line_spt1 = 0.0; input_line_spt2 = 0.0; input_line_spt3 = 0.0; input_line_spt4 = 0.0; input_line_spt5 = 0.0; AddPlot(Brushes.Green, "Long PT 1"); AddPlot(Brushes.Green, "Long PT 2"); AddPlot(Brushes.Green, "Long PT 3"); AddPlot(Brushes.Green, "Long PT 4"); AddPlot(Brushes.Green, "Long PT 5"); AddPlot(Brushes.Red, "Short PT 1"); AddPlot(Brushes.Red, "Short PT 2"); AddPlot(Brushes.Red, "Short PT 3"); AddPlot(Brushes.Red, "Short PT 4"); AddPlot(Brushes.Red, "Short PT 5"); } else if (State == State.Configure) { qqqTicker = new Ticker("Nasdaq", "QQQ", SessionState.Extended); } } protected override void OnBarUpdate() { if (CurrentBar == 0) { diff = 1.0; } else if (BarsInProgress == 0) { double nqClose = Close[0]; double qqqClose = qqqTicker.GetClose(Time[0], Time[1]); diff = Symbol.Name == "QQQ" ? 1.0 : nqClose / qqqClose; } line_lpt1 = SMA(input_line_lpt1 * diff, input_smoothing); line_lpt2 = SMA(input_line_lpt2 * diff, input_smoothing); line_lpt3 = SMA(input_line_lpt3 * diff, input_smoothing); line_lpt4 = SMA(input_line_lpt4 * diff, input_smoothing); line_lpt5 = SMA(input_line_lpt5 * diff, input_smoothing); line_spt1 = SMA(input_line_spt1 * diff, input_smoothing); line_spt2 = SMA(input_line_spt2 * diff, input_smoothing); line_spt3 = SMA(input_line_spt3 * diff, input_smoothing); line_spt4 = SMA(input_line_spt4 * diff, input_smoothing); line_spt5 = SMA(input_line_spt5 * diff, input_smoothing); // Plot lines PlotBrushes[0][0] = Brushes.Green; Values[0][0] = line_lpt1[0]; PlotBrushes[1][0] = Brushes.Green; Values[1][0] = line_lpt2[0]; PlotBrushes[2][0] = Brushes.Green; Values[2][0] = line_lpt3[0]; PlotBrushes[3][0] = Brushes.Green; Values[3][0] = line_lpt4[0]; PlotBrushes[4][0] = Brushes.Green; Values[4][0] = line_lpt5[0]; PlotBrushes[5][0] = Brushes.Red; Values[5][0] = line_spt1[0]; PlotBrushes[6][0] = Brushes.Red; Values[6][0] = line_spt2[0]; PlotBrushes[7][0] = Brushes.Red; Values[7][0] = line_spt3[0]; PlotBrushes[8][0] = Brushes.Red; Values[8][0] = line_spt4[0]; PlotBrushes[9][0] = Brushes.Red; Values[9][0] = line_spt5[0]; } #region Inputs [Browsable(false)] [XmlIgnore()] public string input_date { get; set; } [Range(1, 600), NinjaScriptProperty] [Display(Name = "Line Smoothing", Order = 1, GroupName = "Parameters")] public int input_smoothing { get; set; } [Range(Double.MinValue, Double.MaxValue), NinjaScriptProperty] [Display(Name = "Long PT 1", Order = 2, GroupName = "Parameters")] public double input_line_lpt1 { get; set; } [Range(Double.MinValue, Double.MaxValue), NinjaScriptProperty] [Display(Name = "Long PT 2", Order = 3, GroupName = "Parameters")] public double input_line_lpt2 { get; set; } [Range(Double.MinValue, Double.MaxValue), NinjaScriptProperty] [Display(Name = "Long PT 3", Order = 4, GroupName = "Parameters")] public double input_line_lpt3 { get; set; } [Range(Double.MinValue, Double.MaxValue), NinjaScriptProperty] [Display(Name = "Long PT 4", Order = 5, GroupName = "Parameters")] public double input_line_lpt4 { get; set; } [Range(Double.MinValue, Double.MaxValue), NinjaScriptProperty] [Display(Name = "Long PT 5", Order = 6, GroupName = "Parameters")] public double input_line_lpt5 { get; set; } [Range(Double.MinValue, Double.MaxValue), NinjaScriptProperty] [Display(Name = "Short PT 1", Order = 7, GroupName = "Parameters")] public double input_line_spt1 { get; set; } [Range(Double.MinValue, Double.MaxValue), NinjaScriptProperty] [Display(Name = "Short PT 2", Order = 8, GroupName = "Parameters")] public double input_line_spt2 { get; set; } [Range(Double.MinValue, Double.MaxValue), NinjaScriptProperty] [Display(Name = "Short PT 3", Order = 9, GroupName = "Parameters")] public double input_line_spt3 { get; set; } [Range(Double.MinValue, Double.MaxValue), NinjaScriptProperty] [Display(Name = "Short PT 4", Order = 10, GroupName = "Parameters")] public double input_line_spt4 { get; set; } [Range(Double.MinValue, Double.MaxValue), NinjaScriptProperty] [Display(Name = "Short PT 5", Order = 11, GroupName = "Parameters")] public double input_line_spt5 { get; set; } #endregion } }
Comment