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

How to Add Reference to System.Collections.Generic

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

    How to Add Reference to System.Collections.Generic

    Hello,

    I am attempting to use a List<T> within my code and expose the list as a Public Variable.

    I can't seem to add the Reference to System.Collections.Generic to my Indicator. I go to right click->References->Add but I don't know where to find System.Collections.Generic.dll.

    Can the System.Collections.Generic Namespace be added to Indicators and Strategies?

    I am attempting something like
    Code:
    #region Using declarations
    using System;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Drawing;
    using System.Drawing.Drawing2D;
    using System.Xml.Serialization;
    using System.Collections.Generic; 
    using NinjaTrader.Cbi;
    using NinjaTrader.Data;
    using NinjaTrader.Gui.Chart;
    #endregion
    
    public class myIndi : Indicator
    private List<double>		m_GreenWaveHighs 	= null ; 
    
            protected override void Initialize()
            {
    			// Create List 
    			m_GreenWaveHighs = new List<double>();
             }
    
            protected override void OnBarUpdate()
            {
                  m_GreenWaveHighs.Add(m_CurrWaveHigh) ; 
             }
    
            #region Properties
            [Browsable(false)]	
            [XmlIgnore()]		
            public List<double> M_GreenWaveHighs
            {
                get { Update(); return m_GreenWaveHighs; }
            }
            #endregion
    Last edited by tornadoatc; 04-19-2013, 10:06 AM.

    #2
    In the top of your script, under declarations, you can add this there:

    Code:
    #region Using declarations
    using System.Collections.Generic;
    #endregion
    MatthewNinjaTrader Product Management

    Comment


      #3
      Hi Matthew,

      I did have that in the Using section but when I check the References System.Collections.Generic is not listed under the Assembly list? Should I see System.Collections.Generic with the other System.* related references?

      Can I add the reference using the Reference Dialog? I can't find the .dll files.

      Thanks,
      Last edited by tornadoatc; 04-19-2013, 10:14 AM.

      Comment


        #4
        You would not see it added in the references. However you can add it with the other systems references, but you'll need to know where it is located on your computer. This is commonly in C:\Windows\Microsoft.NET

        The actual location will vary from your system.

        However as you already have a reference to the System.dll, you should be able to access all the methods and properties of the Collections.Generic name space just by adding in your declarations
        MatthewNinjaTrader Product Management

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Tim-c, Today, 03:54 AM
        0 responses
        3 views
        0 likes
        Last Post Tim-c
        by Tim-c
         
        Started by FrancisMorro, Today, 03:24 AM
        0 responses
        3 views
        0 likes
        Last Post FrancisMorro  
        Started by Segwin, 05-07-2018, 02:15 PM
        10 responses
        1,772 views
        0 likes
        Last Post Leafcutter  
        Started by Rapine Heihei, 04-23-2024, 07:51 PM
        2 responses
        31 views
        0 likes
        Last Post Max238
        by Max238
         
        Started by Shansen, 08-30-2019, 10:18 PM
        24 responses
        945 views
        0 likes
        Last Post spwizard  
        Working...
        X