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

properties to variables

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

    properties to variables

    Hello,

    I have a lot of lines in the parameters of a 3rd party indicator and I want to clean it up by not showing in the parameters the constant values that never are changed. I did in some indicators in the variables what I need so that they are working but I don´know yet how to do from the properties to simple variables without getting error messages. When I have in the properties eg

    private double _LevelsRetryInterval = 60;

    [Description("Retry Interval (in seconds).")]
    [GridCategory("A. Operation Parameters")]
    [Gui.Design.DisplayNameAttribute("1.3. Retry Interval")]
    public double RetryInterval
    {
    get { return _RetryInterval; }
    set { _RetryInterval = Math.Max(1, value); }
    }

    what do I have to write in variables please so that it is used with the default value in the indicator without appearing in the parameters.

    Thank you
    Tony

    #2
    Hello tonynt,

    Thank you for your post.

    So I can provide details please answer the following.

    Are you trying to hide the parameters from the Indicators menu for example when you are editing the parameters?
    Are you trying to hide them from the chart view when looking at the bars?

    Comment


      #3
      Hello Patrick,

      thank you for your reply.

      I try to hide the parameters from the indicators menu that I dont need to edit because they are constant all the time, the values will not be changed. They should continue to work in the chart but no one need to change them, so its not necessary that they appear in the parametes menu. (with my understanding it would be enough when they are defined in the code with their default values and work from there)

      Thank you!
      Tony

      Comment


        #4
        Hello tonynt,

        Thank you for your response.

        Do not define them as Public and remove any code that is used for them in the Properties region. Just define them for the class at the top of the code under the Variables region.

        Comment


          #5
          There is no "variables" region in NT 8 so you would define them as private at the top, for example:
          Code:
          	public class SMA : Indicator
          	{
          		private double priorSum;
          		private double sum;

          Comment


            #6
            Hello Patrick,

            thank you for your reply. It is in NT7.

            There is in the example I posted

            private double _LevelsRetryInterval = 60; with "_"
            and public double RetryInterval and then RetryInterval with "_".

            When I comment everything in properties and put

            private double _LevelsRetryInterval = 30; to variables then with compiling I have

            "the name LevelsRetryInterval does not exist in context" (translation by mine)

            PS: Info, this question is for a fellow who has no idea and I said I try to get a solution from the forum (as I resolved already many things with help from the forum). So maybe you can give me one try more what might be wrong when doing so, if with this it doesnt work he has to use a programmer.

            Thanks
            Tony
            Last edited by tonynt; 11-09-2016, 11:03 AM. Reason: typo

            Comment


              #7
              Hello tonynt,

              Can you provide the full code? If you prefer you can send it to platform support via email at platformsupport[at]ninjatrader[dot]com and reference this thread.

              You can attach your indicator to your response by going to File > Utilities > Export NinjaScript > Export selected source files > select your Indicator > select the right arrow > Export. The file will be located under (My) Documents\NinjaTrader 7\bin\Custom\ExportNinjaScript.

              Comment


                #8
                Hello Patrick,

                thank you for your reply. The code is so big and also I´m not allowed to forward it.

                Appreciate your suggestion.

                Thank you for your support!

                Tony

                Comment


                  #9
                  Is "LevelsRetryInterval" defined somewhere or used somewhere?
                  You list your private variable as "_LevelsRetryInterval".

                  Comment


                    #10
                    Hello,

                    yes, it is used in the indicator several times and in the properties its there as posted at the beginning.

                    Tony

                    Comment


                      #11
                      tonynt,

                      You should be removing it from Properties. As you do not want this to be a property that can be viewed.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by judysamnt7, 03-13-2023, 09:11 AM
                      4 responses
                      57 views
                      0 likes
                      Last Post DynamicTest  
                      Started by ScottWalsh, Today, 06:52 PM
                      4 responses
                      35 views
                      0 likes
                      Last Post ScottWalsh  
                      Started by olisav57, Today, 07:39 PM
                      0 responses
                      7 views
                      0 likes
                      Last Post olisav57  
                      Started by trilliantrader, Today, 03:01 PM
                      2 responses
                      19 views
                      0 likes
                      Last Post helpwanted  
                      Started by cre8able, Today, 07:24 PM
                      0 responses
                      9 views
                      0 likes
                      Last Post cre8able  
                      Working...
                      X