Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Question about UserDefinedMethods

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

    Question about UserDefinedMethods

    I'm using UserDefinedMethods.cs to store some basic coding to be able to reuse it in different strategies. It seems that the prices and positions are available to methods without passing them as variables. The question is are variables instantiated within your strategy? So will I be able to maintain a value within a method or should I keep the value locally stored within the strategy? (Maybe this is a General Programming question?)

    #2
    Hello,

    The availability of a variable is defined by what scope you give it. If you only allow it to be used within the method, you will only have access to it in that method. If you declare the variable in the Variables section you will have access to it throughout the entire strategy.
    DenNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    612 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    355 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    105 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    561 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    564 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X