Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

how do I make a variable persistent/global

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

    how do I make a variable persistent/global

    I have an indicator that does some counting for me. I would like the indicator to increment my global variable. Then when I switch to a new instrument, it adds the count from that instrument, etc until I get through all the instruments in my analysis. In MT4 there were global variables that you could set and modify. What is the best way to do that in NT?

    #2
    Hello cre8able,

    There is not anything like that for NinjaScript specifically. You can research using C# static variables however that is not something our support can provide advice on. Static in C# is a complex topic so it is generally best to do some research on how to use static variables in C# in general, you could then apply that how you needed in the platform. Generally you would need to make either a static variable in your class or make a custom class which contains static variables.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    89 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    47 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    74 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    72 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    60 views
    0 likes
    Last Post CarlTrading  
    Working...
    X