Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator values from workspace

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

    Indicator values from workspace

    Hi
    I have an indicator which uses compiler directives to control the [Browseable=true] (or false) statements which are compiled. I'm doing this so that I can set different values depending on the instrument, and then make some of the parameters hidden for other users of the indicator so they can't play with the values.

    So I set these values, saved the workspace, and then recompiled so that the browseable statements were set to false.

    It seems that the indicator is not picking up the workspace values for those indicator parameters which are not visible!! This really would be a problem if it is the case. Can you please confirm (or not) this behaviour.

    Rgds
    Paul

    #2
    Hello,

    Thanks for the forum post.

    This should not be the case. As we do this with saving indicator colors to the workspace. See in the below sample we add Browsable(fasle) and the indicator color serialization still works.



    Let me know if I can be of further assistance.
    BrettNinjaTrader Product Management

    Comment


      #3
      Hi Brett

      This is an example of the code I have for the conditional compilation of the parameters...


      [Description("Maximum Price Area Pivot Variance")]
      [Category("Measurements - Price Areas")]
      #if DEVELOPER
      [Browsable(true)]
      #else
      [Browsable(false)]
      #endif
      [Gui.Design.DisplayNameAttribute("Maximum Pivot Variance")]
      public double MaxPAVariance
      {
      get { return maxPAVariance; }
      set { maxPAVariance = value; }
      }

      When I comment out the #define DEVELOPER directive, the values for the affected parameters are not as per the saved workspace. When it is not commented, the values are read correctly. I've confirmed this with some PRINT statements.

      Rgds
      Paul

      Comment


        #4
        Hello,

        Just to double check, And what you you setting in maxPAVariance in the variables section? Are you initializing it with some default value?
        BrettNinjaTrader Product Management

        Comment


          #5
          Yes in the variables section I am defaulting it to 1. However in the workspace it is set to 0.0002.

          Those are the 2 different values I am seeing depending on how the compiler directive is set.

          Rgds
          Paul

          Comment


            #6
            OK - I've stripped my indicator right down and have an example indicator and workspace which demonstrates this behaviour. Let me know if you want it.

            Rgds
            Paul

            Comment


              #7
              Hello,

              We have tested this on our side.

              With [Browsable(false)]

              This value saves to the workspace.

              [Browsable(false)]
              public int MyInput0
              {
              get { return myInput0; }
              set { myInput0 = Math.Max(1, value); }
              }


              I will find <MyInput0>1234</MyInput0> in the worksapce file with whatever value I initialized it too.

              What does your test scenario look like? As mine tests good.

              I look forward to assisting you further.
              BrettNinjaTrader Product Management

              Comment


                #8
                Try this indicator and workspace - it doesn't retrieve the saved values whenever I compile with the directive on.

                However I have noticed that the values are saved correctly in the workspace, so it seems to be a parameter retrieval problem.
                Attached Files
                Last edited by pauly139; 03-24-2011, 05:01 PM. Reason: Appending

                Comment


                  #9
                  Are you working on NT7 here Paul? Then Category would be GridCategory in your Properties section.

                  Comment


                    #10
                    Thanks Bertrand. Unfortunately the underlying problem with incorrect parameter values still exhibits.

                    Rgds
                    Paul

                    Comment


                      #11
                      Hello,

                      Seems issue is the [Browsable(true)] , as then I comment this out. I see the parameter and it save correctly to the workspace and restored correctly from the workspace.

                      There is no need for such a set. As you simply dont use this when you want it to be visable.

                      So your options are either no [Browsable(false)] listed when you want it to be browsable.

                      or [Browsable(fasle)] is listed when you do not want it to be visable.

                      There is no Browsable(true) setting.

                      Let me know if I can be of further assistance.
                      BrettNinjaTrader Product Management

                      Comment


                        #12
                        Hi Brett
                        I tried what you suggested and still see the problem. I've attached the test indicator modified as per your suggestion.

                        I saved a value of 0.001 against the parameter and saved the workspace. I then edited the code and uncommented the "#define GENERAL" statement at the top of the code and recompiled.

                        Next time I opened the workspace the parameter held 1 as per the default, not 0.001 as per the workspace.

                        Rgds
                        Paul
                        Attached Files

                        Comment


                          #13
                          Hello,

                          Ok I now see what your doing now. I'm not changing this to get it to work if I keep it at one setting or the other. If you change this midflight, this would be expected you would not be able to change this and retain the value out of the workspace. This would be unsupported to be able to change this on the fly.

                          You would need to save any variaables you do not want browsable to a txt file and load it from here if you must have these parameters hidden.
                          1. Using StreamWriter to write to a text file
                          2. Using StreamReader to read from a text file
                          BrettNinjaTrader Product Management

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                          0 responses
                          581 views
                          0 likes
                          Last Post Geovanny Suaza  
                          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                          0 responses
                          338 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by Mindset, 02-09-2026, 11:44 AM
                          0 responses
                          103 views
                          0 likes
                          Last Post Mindset
                          by Mindset
                           
                          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                          0 responses
                          554 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by RFrosty, 01-28-2026, 06:49 PM
                          0 responses
                          552 views
                          1 like
                          Last Post RFrosty
                          by RFrosty
                           
                          Working...
                          X