Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Parameter Error

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

    Parameter Error

    The following code causes the attached error when I load the strategy on a chart. However, the stategy seems to work fine.
    When I load it on the strategy analyzer, no error occurs.

    I have tried to enter parameters with objHighBarsAgoNumber (which is what the error seem to be about) but I can't get it to compile. The strategy is doing what it should. I would like some insight on what the error is happening.


    objHighBarsAgoNumber.Set (Highs[
    0][1]);
    //
    HighBarsAgoNumber = (HighestBar(objHighBarsAgoNumber,30)+1);

    Thank you,
    Duke




    Attached Files

    #2
    Can you post the code you're using in #region Properties?
    MatthewNinjaTrader Product Management

    Comment


      #3
      Sure thing, Matthew---
      Thanks for checking this out ..

      #region Variables
      // Wizard generated variables
      private int myInput0 = 1; // Default setting for MyInput0
      // User defined variables (add any user defined variables below)
      double SMACurrent;
      double SMAPast;
      double DiffMACDCurrent;
      double DiffMACDPast;
      double DiffMACDCalc;
      double HighValuePast;
      double HighValueCurrent;
      double LowValueCurrent;
      double LowValuePast;
      int HighBarsAgoNumber;
      int LowBarsAgoNumber;
      public DataSeries objHighBarsAgoNumber;
      public DataSeries objLowBarsAgoNumber;
      string DateTime;

      Comment


        #4
        Sorry Duke - I meant the #region Properties section which is below OnBarUpdate()

        Although - do you mean to expose this data series as public? You might just wanna try changing it to private DataSeries in your Variables section

        Pleaes have a look at our DataSeries class of our Help Guide for information on how to declare and set a data series:

        MatthewNinjaTrader Product Management

        Comment


          #5
          Sorry, Matthew.. my fault,
          #region Properties
          [Description("")]
          [GridCategory("Parameters")]
          public int MyInput0
          {
          get { return myInput0; }
          set { myInput0 = Math.Max(1, value); }
          }

          #endregion

          Comment


            #6
            Thanks - in Variables can you please set thees data series as private:

            Code:
            private DataSeries objHighBarsAgoNumber;
            private DataSeries objLowBarsAgoNumber;
            MatthewNinjaTrader Product Management

            Comment


              #7
              Matthew,
              That fixed it. Can you explain the problem?
              Thank you very much..
              Duke

              Comment


                #8
                A public variable needs to be serialized which can then be used as a public property.

                Since you're not exposing this data series outside of this script, there is no need to serialize this data series and you can simply declare it as private.

                If you wanted to expose this data series to another indicator or strategy, you can link the private DataSeries to a Public DataSeries which would then be serialized in the #region Properties section.

                If you'd like to learn more about this, please see our Help Guide article on Exposing indicator values which are not plots:

                MatthewNinjaTrader Product Management

                Comment


                  #9
                  Thank you Matthew..

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  633 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  364 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  105 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  567 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  568 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X