Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Adding To Position

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

    #16
    Thanks for the reply. What you're running into is variable scope. To overcome this, we recommend declaring all variables in the variables region, so that they're available any place you need in your script.

    #region Variables
    private bool LongSet = false;
    private double LongPrice;
    #endregion

    When you want to use these variables in your code, you don't need to place the type (double, bool) in front.

    LongSet = true;
    LongPrice = GetCurrentAsk();
    Last edited by NinjaTrader_RyanM1; 09-02-2011, 01:21 PM.
    Ryan M.NinjaTrader Customer Service

    Comment


      #17
      I noticed in the last two posts that the declaration of the variable is "longSet" and the usage of the variable is "LongSet" (different cases/spellings). Since C# is case sensitive, could this be the issue?

      Comment


        #18
        dojidubbs,

        private variables are lower case.

        Public variables are upper case.

        When declaring your variables, they first should to be declared as private. When using the variables in your script we recommend using them as Public variables.

        We do not have any educational resources on the differences between using these variables - if you'd like clarification on these you should check MSDN or other C# educational resources.
        MatthewNinjaTrader Product Management

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        60 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        147 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        161 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        97 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        284 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X