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

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 Jonafare, 12-06-2012, 03:48 PM
          5 responses
          3,984 views
          0 likes
          Last Post rene69851  
          Started by Fitspressorest, Today, 01:38 PM
          0 responses
          2 views
          0 likes
          Last Post Fitspressorest  
          Started by Jonker, Today, 01:19 PM
          0 responses
          2 views
          0 likes
          Last Post Jonker
          by Jonker
           
          Started by futtrader, Today, 01:16 PM
          0 responses
          6 views
          0 likes
          Last Post futtrader  
          Started by Segwin, 05-07-2018, 02:15 PM
          14 responses
          1,791 views
          0 likes
          Last Post aligator  
          Working...
          X