Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

QQQ TO NQ Indicator (Need help with errors)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    QQQ TO NQ Indicator (Need help with errors)

    So I have been working on a code that converts QQQ levels to NQ and will make a new indicator that will convert SPY to ES. Reason for doing this is because SPY & QQQ tend to have better volume levels compared to ES/NQ. I have developed a code to convert these levels, but for some reason am getting a error code and for life of me can't figure out what it is. I have imported all the correct 3rd party systems, but still can't figure it out. Any help would be greatly appreciated. Code posted down below. Error code also posted

    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

    HTML Code:
    #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
        }
    }
    ​

    #2
    You have to add reference to namespace where Ticker class is defined. Do you have an indicator that uses this class? Look at declarations in it (where "using" keywords).

    Comment


      #3
      Hello josh18955,

      Thanks for your post.

      This error can occur when an imported DLL (could be a 3rd party indicator) you are referencing no longer exists / has been removed.

      To resolve this the DLL must be re-imported.

      To re-import a 3rd party dll:
      • Open the NinjaScript Editor via New > NinjaScript editor.
      • Right mouse click in the NinjaScript Editor main window and select the menu name "References"
      • In the "References" dialog window press the button "Add"
      • Select the 3rd party DLL
      ​See this help guide page for more information about CS0246: https://ninjatrader.com/support/help...nt8/cs0246.htm

      Please let me know if I may assist further.
      <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

      Comment


        #4
        Originally posted by NinjaTrader_BrandonH View Post
        Hello josh18955,

        Thanks for your post.

        This error can occur when an imported DLL (could be a 3rd party indicator) you are referencing no longer exists / has been removed.

        To resolve this the DLL must be re-imported.

        To re-import a 3rd party dll:
        • Open the NinjaScript Editor via New > NinjaScript editor.
        • Right mouse click in the NinjaScript Editor main window and select the menu name "References"
        • In the "References" dialog window press the button "Add"
        • Select the 3rd party DLL
        ​See this help guide page for more information about CS0246: https://ninjatrader.com/support/help...nt8/cs0246.htm

        Please let me know if I may assist further.
        How do I know which DLL I am supposed to import and where can I find them?

        Comment


          #5
          Hello josh18955,

          Thanks for your note.

          In the code you shared, you are calling 'private Ticker qqqTicker'.

          Ticker is not a C# Keyword like double, int, bool, etc. Ticker is also not a class or indicator that comes default with NinjaTrader. A reference to the namespace where Ticker is being defined would likely need to be added to your script.

          Do you have an indicator that uses this 'Ticker' class?

          Is this 'Ticker' class from a third-party indicator?

          Do you have an indicator named 'Ticker' that you are trying to use in the script? How is 'Ticker' defined in the indicator script you are trying to access?

          Let me know if I may assist further.
          <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

          Comment


            #6
            What was the resolution to this? A DLL reference? If so, what was the DLL?

            Comment


              #7
              I'm curious to know if this was resolved too because I'm interested in an indicator that can do this for NT8. I know of an indicator on Tradingview that will do these conversions but it will cost some $$ to convert it to Ninjascript according to a developer I know.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, 03-13-2026, 05:17 AM
              0 responses
              255 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              252 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              125 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              81 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              108 views
              0 likes
              Last Post TheRealMorford  
              Working...
              X