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

Parameters in UserDefinedMethods

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

    Parameters in UserDefinedMethods

    Hi there

    I added a bool method to Parameters in my UserDefinedMethods.cs file.

    private bool iShowOnly = false;

    [Description("")]
    [GridCategory("Parameters")]
    publicbool ShowOnly
    {
    get { return iShowOnly; }
    set { iShowOnly = value; }
    }

    Since UserDefinedMethods.cs is public it shows in Parameters for all indicators. I only want to use it with a couple of indicators not all of them. Is there a way to restrict to which ones?

    Btw - I can't put the code just in the indicators I need because the methods I use are coded and referenced in the UserDefinedMethods.cs file...

    Thx
    Irvin

    #2
    Are you wanting this bool to show up on the parameters grid of only some indicators not others?

    Or are you just wanting some indicators to have the ability to access this bool?
    MatthewNinjaTrader Product Management

    Comment


      #3
      The former ... Some indicators.

      Comment


        #4
        Unfortunately i'm not aware of away to only have these public defined parameters show up on only some indicators grid.

        The only thing you would be able to do is create a public bool which could be accessed by the other indicator code directly, however you wouldn't be able to change this parameter from the Grid parameters.

        public bool iShowOnly = false;


        We will leave this thread open in the case another community member has experience in this area.
        MatthewNinjaTrader Product Management

        Comment


          #5
          Originally posted by NinjaTrader_Matthew View Post
          Unfortunately i'm not aware of away to only have these public defined parameters show up on only some indicators grid.

          The only thing you would be able to do is create a public bool which could be accessed by the other indicator code directly, however you wouldn't be able to change this parameter from the Grid parameters.

          public bool iShowOnly = false;


          We will leave this thread open in the case another community member has experience in this area.
          Hi Matthew

          I got it to work another way.

          I added a boolean input into my method that is referenced from the indicators that need it.

          In UserDefinedMethods.cs:
          public bool MyMethod(bool iShowOnly)
          if iShowOnly = false
          // do something from before
          else
          // do something less

          Calling the method in the indicator: if MyMethod(ShowOnly) == true

          Thx
          Irvin

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by bortz, 11-06-2023, 08:04 AM
          47 responses
          1,610 views
          0 likes
          Last Post aligator  
          Started by jaybedreamin, Today, 05:56 PM
          0 responses
          9 views
          0 likes
          Last Post jaybedreamin  
          Started by DJ888, 04-16-2024, 06:09 PM
          6 responses
          19 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by Jon17, Today, 04:33 PM
          0 responses
          6 views
          0 likes
          Last Post Jon17
          by Jon17
           
          Started by Javierw.ok, Today, 04:12 PM
          0 responses
          16 views
          0 likes
          Last Post Javierw.ok  
          Working...
          X