Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

error message CS1501 problem

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

    error message CS1501 problem

    I created an indicator with no input parameters and it compiled with no errors.
    I changed nothing in the indicator code meaning I did not replace the “Plot0.Set(Close[0]);” statement in the “OnBarUpdate()” section [reproduced below in larger font].

    protected override void OnBarUpdate()
    {
    // Use this method for calculating your indicator values. Assign a value to each
    // plot below by replacing 'Close[0]' with your own formula.
    Plot0.Set(Close[0]);
    }

    I added an “Add(joeHACindicator());” statement to my strategy
    expecting a line to appear on a strategy analyzer chart passing
    thru the close of every bar.

    However , the strategy failed to compile with the error CS1501 “no overload for method ‘joeHACindicator’ takes ‘0’ arguments.”

    I have absolutely no idea what that means or where to start trying to resolve the problem so will greatly appreciate any help.

    #2
    Hello,

    We would need to see the joeHACindicator in order to know how to reference it correctly.


    We have also collected more comprehensive steps for resolving NinjaScript programming errors in this tip on our forums - http://www.ninjatrader.com/support/f...ead.php?t=4678
    MatthewNinjaTrader Product Management

    Comment


      #3
      indicator code is attached, i think? thanks Matthew

      code was > 10,000 so had to attach it.
      after several attempts to save a Word doc in acceptable format I think it finally is happy with a pdf file which is what I think is attached.

      for future reference what procedure should I use to attach a file?

      Attached Files

      Comment


        #4
        In the future, you can always just upload the actual cs file contained in Documents\NinjaTrader 7\bin\custom\Indicator\<your indicator name>.cs

        Your indicator is expecting input from the following parameter:

        Code:
        [Description("")] 
        [GridCategory("Parameters")] 
        publicint MyInput0 
        { 
        get { return myInput0; } 
        set { myInput0 = Math.Max(1, value); } 
        }
        You will either need to remove this area in the code, or you can simply pass a dummy value to the indicator in the strategy:

        Code:
        Add(joeHACindicator(1));
        MatthewNinjaTrader Product Management

        Comment


          #5
          many thanks for the help

          many thanks for the help

          Comment


            #6
            creating a new indicator when the indicator has no input parms:

            regarding use of the wizard to create a new indicator when the indicator has no input parms:

            I tried deleting the automatic specification of MyInput0 and Plot0 resulting in a skeleton code for the indicator [ie] appeared to contain no prebuilt code which means the wizard did nothing of use to me.

            so is the following the best way to create an indicator which has no input parms using the wizard?
            1. change nothing, just use the wizard defaults for MyInput0 and Plot0.
            2. then do as suggested below [ie]
            Your indicator is expecting input from the following parameter:
            Code:
            [Description("")] [GridCategory("Parameters")] publicint MyInput0 { get { return myInput0; } set { myInput0 = Math.Max(1, value); } }
            You will either need to remove this area in the code, or you can simply pass a dummy value to the indicator in the strategy:

            Comment


              #7
              new indicator which uses in its definition an existing indicator

              I am trying to create a new indicator [joeHAOindicator] which uses in its definition an existing indicator [joeHACindicator3] created previously by me.
              I am getting the old familiar cs error messages [ie] cs1501,02,03,19 & 21. As before I cannot figure out how to fix the problem. I have read the error messages and unsuccessfully experimented with various attempted fixes.

              Code for joeHAOindicator is attached. Hate to dump it on you but I am doing it anyhow.
              Your help will be much appreciated.
              Attached Files

              Comment


                #8
                Originally posted by joemiller View Post
                I am trying to create a new indicator [joeHAOindicator] which uses in its definition an existing indicator [joeHACindicator3] created previously by me.
                I am getting the old familiar cs error messages [ie] cs1501,02,03,19 & 21. As before I cannot figure out how to fix the problem. I have read the error messages and unsuccessfully experimented with various attempted fixes.

                Code for joeHAOindicator is attached. Hate to dump it on you but I am doing it anyhow.
                Your help will be much appreciated.
                Please post the region for joeHACindicator3.

                this is what joeHAOindicator looks like:

                Code:
                // This namespace holds all strategies and is required. Do not change it.
                namespace NinjaTrader.Strategy
                {
                    public partial class Strategy : StrategyBase
                    {
                        /// <summary>
                        /// trash    temp for test
                        /// </summary>
                        /// <returns></returns>
                        [Gui.Design.WizardCondition("Indicator")]
                        public Indicator.joeHAOindicator joeHAOindicator(int myInput0)
                        {
                            return _indicator.joeHAOindicator(Input, myInput0);
                        }
                
                        /// <summary>
                        /// trash    temp for test
                        /// </summary>
                        /// <returns></returns>
                        public Indicator.joeHAOindicator joeHAOindicator(Data.IDataSeries input, int myInput0)
                        {
                            if (InInitialize && input == null)
                                throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");
                
                            return _indicator.joeHAOindicator(input, myInput0);
                        }
                    }
                }
                #endregion

                Comment


                  #9
                  ok .... I think I have posted joeHACindicator3.

                  ok .... I think I have posted joeHACindicator3.
                  many thanks
                  Attached Files

                  Comment


                    #10
                    Originally posted by joemiller View Post
                    ok .... I think I have posted joeHACindicator3.
                    many thanks
                    Did you try as NT_Mathew suggested earlier?



                    Code:
                    You will either need to remove this area in the code, or you can simply pass a dummy value to the indicator in the strategy:
                    
                    Code:
                    [I]Add(joeHACindicator(1));
                    [/I]

                    Your constructors require a parameter.


                    Code:
                            public joeHAOindicator joeHAOindicator(int myInput0)
                    
                    
                            public joeHAOindicator joeHAOindicator(Data.IDataSeries input, int myInput0)

                    Comment


                      #11
                      yes, I did do as Mathew suggested which is why joeHACindicator finally compiled and worked successfully when plotted on a strategy analyzer graph.

                      should public joeHAOindicator joeHAOindicator(int myInput0) and
                      public joeHAOindicator joeHAOindicator(Data.IDataSeries input, int myInput0)
                      go in joeHAOindicator or joeHAC3indicator, or both?

                      Comment


                        #12
                        HAOindicator fails to compile, with error code cs0542

                        joeHAOindicator fails to compile with error code cs0542. Clicking for info gives no further info.

                        I have not a clue what is meant by the error description "joeHAOindicator' member names cannot be the same as their enclosing type".

                        Any help will be greatly appreciated.

                        A program listing is attached.

                        I added two lines of code at lines 27 & 28.
                        Attached Files

                        Comment


                          #13
                          Originally posted by joemiller View Post
                          joeHAOindicator fails to compile with error code cs0542. Clicking for info gives no further info.

                          I have not a clue what is meant by the error description "joeHAOindicator' member names cannot be the same as their enclosing type".

                          Any help will be greatly appreciated.

                          A program listing is attached.

                          I added two lines of code at lines 27 & 28.
                          Please remove lines 27 and 28.

                          I only quoted that code, because I was showing you the ninjatrader generated constructor for your other indicator, trying to show that it takes a number as a parameter, and what NT_Matthew suggested (put a number) would make it compile.

                          Comment


                            #14
                            thanks Sledge.

                            one of my problems is I have no idea what a 'constructor' is.
                            I will work on that problem now.

                            Comment


                              #15
                              Originally posted by joemiller View Post
                              thanks Sledge.

                              one of my problems is I have no idea what a 'constructor' is.
                              I will work on that problem now.
                              constructors:

                              A constructor in C# is called when a class or struct is created. Use constructors to set defaults, limit instantiation, and write flexible, easy-to-read code.


                              Basically it's what needs called to create something.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by maybeimnotrader, Today, 05:46 PM
                              0 responses
                              6 views
                              0 likes
                              Last Post maybeimnotrader  
                              Started by quantismo, Today, 05:13 PM
                              0 responses
                              6 views
                              0 likes
                              Last Post quantismo  
                              Started by AttiM, 02-14-2024, 05:20 PM
                              8 responses
                              166 views
                              0 likes
                              Last Post jeronymite  
                              Started by cre8able, Today, 04:22 PM
                              0 responses
                              8 views
                              0 likes
                              Last Post cre8able  
                              Started by RichStudent, Today, 04:21 PM
                              0 responses
                              5 views
                              0 likes
                              Last Post RichStudent  
                              Working...
                              X