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 rocketman7, Today, 01:00 AM
          0 responses
          1 view
          0 likes
          Last Post rocketman7  
          Started by wzgy0920, 04-20-2024, 06:09 PM
          2 responses
          27 views
          0 likes
          Last Post wzgy0920  
          Started by wzgy0920, 02-22-2024, 01:11 AM
          5 responses
          32 views
          0 likes
          Last Post wzgy0920  
          Started by wzgy0920, 04-23-2024, 09:53 PM
          2 responses
          74 views
          0 likes
          Last Post wzgy0920  
          Started by Kensonprib, 04-28-2021, 10:11 AM
          5 responses
          193 views
          0 likes
          Last Post Hasadafa  
          Working...
          X