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

Cannot use System.Collections?!

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

    Cannot use System.Collections?!

    Hi,

    I created a new strategy with the wizard and added

    using System.Collections;
    ...
    HashTable foo=new HashTable();

    Intellisense knows HashTable but I get CS0246. According to Google System.Collections is part of System.dll which is listed in my references (rightclick, refs). Whats wrong?

    #2
    dilbert67,

    Please provide the full error message. Thank you.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      hi,

      the localized msg is

      "Strategy\MyCustomStrategy2.cs Der Typ- oder Namespacename HashTable konnte nicht gefunden werden. (Fehlt eine using-Direktive oder ein Assemblyverweis?) CS0246 - click for info 30 3"

      eg "type or namespacename hashtable cannot be found (Missing using directive or assembly ref?)

      #####################

      #region Using declarations
      using System;
      using System.ComponentModel;
      using System.Diagnostics;
      using System.Drawing;
      using System.Drawing.Drawing2D;
      using System.Xml.Serialization;
      using NinjaTrader.Cbi;
      using NinjaTrader.Data;
      using NinjaTrader.Indicator;
      using NinjaTrader.Gui.Chart;
      using NinjaTrader.Strategy;
      #endregion
      using System.Collections;

      // This namespace holds all strategies and is required. Do not change it.
      namespace NinjaTrader.Strategy
      {
      /// <summary>
      /// Enter the description of your strategy here
      /// </summary>
      [Description("Enter the description of your strategy here")]
      public class MyCustomStrategy2 : Strategy
      {
      #region Variables
      // Wizard generated variables
      private int myInput0 = 1; // Default setting for MyInput0
      // User defined variables (add any user defined variables below)
      #endregion
      HashTable foo;

      /// <summary>
      /// This method is used to configure the strategy and is called once before any strategy method is called.
      /// </summary>
      protected override void Initialize()
      {
      CalculateOnBarClose = true;
      }

      /// <summary>
      /// Called on each bar update event (incoming tick)
      /// </summary>
      protected override void OnBarUpdate()
      {
      }

      #region Properties
      [Description("")]
      [Category("Parameters")]
      public int MyInput0
      {
      get { return myInput0; }
      set { myInput0 = Math.Max(1, value); }
      }
      #endregion
      }
      }


      #####################

      Comment


        #4
        Please try Hashtable without the capital T.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          i guess i qualified as the idiot of the week

          :-)

          thanks anyway

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by judysamnt7, 03-13-2023, 09:11 AM
          4 responses
          59 views
          0 likes
          Last Post DynamicTest  
          Started by ScottWalsh, Today, 06:52 PM
          4 responses
          36 views
          0 likes
          Last Post ScottWalsh  
          Started by olisav57, Today, 07:39 PM
          0 responses
          7 views
          0 likes
          Last Post olisav57  
          Started by trilliantrader, Today, 03:01 PM
          2 responses
          21 views
          0 likes
          Last Post helpwanted  
          Started by cre8able, Today, 07:24 PM
          0 responses
          10 views
          0 likes
          Last Post cre8able  
          Working...
          X