Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

referencing a variable from another indicator

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

    referencing a variable from another indicator

    Is it possible to reference a variable from another indicator that is also running in a separate market analyzer column? I'm assuming this is possible because otherwise you would have to keep repeating the same code over and over again if you're making an indicator with a lot of inputs. For example, let's say I have indicator 1 and indicator 2 both running in the market analyzer and i want to use data assigned to to a double that is obtained from a method in indicator 1 and use it as a double in an if statement in indicator 2. I could just copy the code for that trigger in the 2nd indicator but some of these methods are really long and to use the inputs from various triggers to make a new trigger it would be easier to just be able to reference them from other indicators that are already running.

    #2
    Hello gordongekko,

    Thanks for opening the thread.

    In a strategy or indicator we can add a new instance of an indicator and reference the public variables and methods of an instance of an indicator to use those exposed variables. The strategy or the indicator that these instances are added to provides the foundation to be able to share data between indicators. (We need to have an instance of a class to reference a member variable.) This is demonstrated in the SampleBoolSeries script in our Reference Samples section of the forums.

    Indicators added to the Market Analyzer would not be added in a way you can easily reference the data from one indicator in another indicator. This would be similar to having two separate indicators on a chart and trying to share data between them. There is some information for looping through the indicator's collection in a chart, but we do not have similar information available for looping through indicators in the Market Analyzer.

    It is possible to create an AddOn with static variables to hold some data and share it between different indicators, however. I'll link to a thread where this question has come up before and where we have a demonstration script to provide further direction.

    MySharedMethodsAddOnExample - https://ninjatrader.com/support/foru...d.php?t=103388

    Please let me know if I can be of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    589 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    342 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    555 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    552 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X