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

Iterate Through Instrument List

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

    Iterate Through Instrument List

    I would like to be able to prgramatically record the values of several dataseries exposed by multiple custom indicators for a list of instruments. This would roughly be the equivalent of having an instrument list in the market analyzer with several columns of indicator values and automatically exporting the results. I imagine that I could program each of the indicators to write out the results and call them all from the market analyzer, but might there be a cleaner way to accomplish the task and bypass the market analyzer?
    Last edited by dkrumholz; 06-30-2012, 02:57 AM.

    #2
    dkrumholz,

    I would be happy to assist where I am allowed. Could you describe what you want to do in more detail? I am not currently sure what you mean here.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      I have the Market Analyzer open with 200 instruments in the list. I have two indicators loaded in additional columns. I could export the current market analyzer view to Excel. That requires that I be at the machine and do that export. I would like to accomplish the same task progamatically so I do not need to be at the computer and do that export. I could have the indicators each write out the data, but I would still need to iterate through the instrument list. Can I programatically have an indicator iterate through an instrument list? I suppose I cound open the market analyzer and if the instrument list was loaded and each indicator was added to the analyzer and each indicator recorded its own values then I would accomplish the task. Is that correct? Even if that is true is there an alternate way to accomplish the task without using the market analyzer?

      Comment


        #4
        One way of doing this would be to add all 200 instruments in Initialize() and then loop through them with a for loop containing all of the indicators whose values you want to record, like this:

        for (int i = 0; i < 200; i++)
        {
        EMA(Closes[i][0])
        SMA(Closes[i][0])
        //etc
        }

        Comment


          #5
          That seems like a perfectly reasonable approach. Is there any way to "load" an indicator without putting it on a chart - similar to the way the Market Analyzer does?

          Comment


            #6
            I'm not sure what you mean

            Comment


              #7
              Originally posted by dkrumholz View Post
              That seems like a perfectly reasonable approach. Is there any way to "load" an indicator without putting it on a chart - similar to the way the Market Analyzer does?
              An indicator indicates something, so it must be applied to something. In NT, it appears that the something to which an indicator is applied will be a chart or the Market Analyzer, or if we want to stretch things, as an indicator can be called by a Strategy, so we can call that too an application of the indicator. Then again the Strategy too will be applied to a chart, so even that is just an indirect application of the indicator to the chart.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by trilliantrader, Today, 03:01 PM
              0 responses
              2 views
              0 likes
              Last Post trilliantrader  
              Started by pechtri, 06-22-2023, 02:31 AM
              9 responses
              122 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by frankthearm, 04-18-2024, 09:08 AM
              16 responses
              67 views
              0 likes
              Last Post NinjaTrader_Clayton  
              Started by habeebft, Today, 01:18 PM
              1 response
              8 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by benmarkal, Today, 12:52 PM
              2 responses
              19 views
              0 likes
              Last Post benmarkal  
              Working...
              X