Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Identify Instruments on a chart

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

    Identify Instruments on a chart

    Hi,

    I have a chart with two instruments loaded on it, and I want to identify the instruments.

    I have tried

    else if (State == State.DataLoaded)
    {
    int ii=0;
    // Print all instruments which have been loaded
    foreach (Instrument i in Instruments)
    {
    Print( ii.ToString() + " " + i.FullName);
    ii++;
    }
    }

    but this only identifies the primary instrument.

    Thanks for any assistance you can provide.

    Ian

    #2
    Hello IanC28,

    Thanks for opening the thread.

    The Instruments object in a strategy or indicator will only know the data series that are manually added to that NinjaScript. Since Strategies and Indicators are attached to a data series, it will not be able to detect external data series that are added to a chart.

    You could create a workaround by creating a simple indicator that attaches to your chart's additional data series and stores the name of the attached instrument to a common place that can then be read by the indicator or strategy attached to the primary data series.

    This way you could keep track of instruments added to a chart and recall them from another NinjaScript.

    You will have to roll your own way to keep track of instruments added to specific charts so they do not simply add to a list of all instruments added to a chart.

    Our colleague Chelsea has a sample script on our forums that demonstrates how to create an AddOn that can be used to share methods between NinjaScripts. This should be useful to get started creating this functionality.



    Alternately, if you would like someone to write this functionality for you, we could have a memeber of our Business Development Team pass over a list of NinjaScript Consultants who would be happy to do so. If that is the case, please write in to platformsupport[at]ninjatrader[dot]com with the thread URL and the text "Attention Jim."

    Please let me know if i may be of further assistance.

    Comment


      #3
      Thanks Jim,

      Seems a bit complicated.

      The code used identifies all the data series loaded. It is strange it cannot detect an additional instrument.

      I have parameters identifying the data I want to work with, but I thought I could minimize the parameters by picking up the instruments on the chart.

      Thanks again

      Ian

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      607 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      353 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
      560 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      561 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X