Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    JimNinjaTrader Customer Service

    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 owensd, 04-21-2024, 11:34 PM
      9 responses
      34 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by trilliantrader, 04-10-2024, 09:33 PM
      7 responses
      25 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by traderqz, Today, 12:06 AM
      5 responses
      11 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by Mongo, Today, 11:05 AM
      2 responses
      10 views
      0 likes
      Last Post Mongo
      by Mongo
       
      Started by guillembm, Today, 11:25 AM
      0 responses
      5 views
      0 likes
      Last Post guillembm  
      Working...
      X