Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exposed Variable

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

    Exposed Variable

    Hi,

    In layman terms, could you please explain what is an ExposedVariable and occasions where it is required?

    Regards
    Kay Wai

    #2
    Hello Kay Wai,

    An exposed variable is used to access information within the class of the strategy or indicator.

    This uses the 'public' access modifier.
    All types and type members in C# have an accessibility level that controls whether they can be used from other code. Review this list of access modifiers.


    This is used when you want an input in the Indicators or Strategies window for the parameters of a script, or if you want to have an indicator that has a value you would like to call from a host script like a strategy.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you Chelsea. Still seems alien to me! I'll ask again if I further questions.

      Comment


        #4
        kaywai You can think of it as a variable in someone else's code that is visible to, and accessible/usable by, code you have written. It is "exposed" to "outside" code. A variable that is not exposed may still be visible using code viewing tools (or in the source, if available), but it will not be accessible or usable by code outside the dll (i.e. the assembly) it is part of. It is protected from "public" use.

        So, as NinjaTrader_ChelseaB observes, "exposed" and "public" are both ways to describe this, but "public" also corresponds to the actual C# code (the access modifier) used to expose a variable. For example, the code public int x = 0; makes the variable x exposed and usable by outside code; whereas the code private int x = 0; protects the variable from any use other than within the original dll.

        Hope that helps.
        Multi-Dimensional Managed Trading
        jeronymite
        NinjaTrader Ecosystem Vendor - Mizpah Software

        Comment


          #5
          Hi Jeronymite,

          That makes sense!. Thank you for that. Appreciate it.

          Regards
          Kay Wai

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          558 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          324 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          545 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          547 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X