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

Constant Error Message

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

    Constant Error Message

    I just installed NT 6.5.1000.6 and every time I try to compile a new strategy, I get the message '"NinjaTrader.Data.Period' is a 'type' but is used like a 'variable'

    No matter what I tried, I kept getting the message, so I used the wizard to create a simple strategy (below) and it still happens. By the way, the error was stated 10 times on the strategy below...... (Lines 34, 35, 36, 37, 51, 52, 54, 54, 56, 56)

    Any ideas?????
    // 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")]
    publicclass Junk : Strategy
    {
    #region Variables
    // Wizard generated variables
    privateint myInput0 = 1; // Default setting for MyInput0
    // User defined variables (add any user defined variables below)
    #endregion
    ///<summary>
    /// This method is used to configure the strategy and is called once before any strategy method is called.
    ///</summary>
    protectedoverridevoid Initialize()
    {
    CalculateOnBarClose = true;
    }
    ///<summary>
    /// Called on each bar update event (incoming tick)
    ///</summary>
    protectedoverridevoid OnBarUpdate()
    {
    // Condition set 1
    if (CrossAbove(EMA(14), EMA(50), 1))
    {
    EnterLong(DefaultQuantity, "");
    }
    }
    #region Properties
    [Description("")]
    [Category("Parameters")]
    publicint MyInput0
    {
    get { return myInput0; }
    set { myInput0 = Math.Max(1, value); }
    }
    #endregion
    }
    }

    #2
    Hello,

    To compile you need all your files error free. The error originates from another one of your NinjaScript files. Double click the error from the NinjaScript Editor and it will bring you to the file in question. Please fix the error from there.

    The code you posted below compiles fine for me with no errors.
    DenNinjaTrader Customer Service

    Comment


      #3
      Thanks Ben! I figured it out.....I had just imported a ninjascript from the sharing thread that was causing the problem...got rid of it....and everything is fine. (I had no idea that an error in another strategy would cause other strategies to not compile???) Thanks for your help!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by spencerp92, 10-10-2023, 09:56 AM
      4 responses
      301 views
      0 likes
      Last Post flybuzz
      by flybuzz
       
      Started by samish18, Yesterday, 10:13 AM
      1 response
      23 views
      0 likes
      Last Post NinjaTrader_Eduardo  
      Started by Austiner87, Today, 05:02 PM
      0 responses
      5 views
      0 likes
      Last Post Austiner87  
      Started by tonynt, 05-21-2019, 06:27 AM
      10 responses
      530 views
      1 like
      Last Post fiendtrades  
      Started by awwenzovs, Today, 08:03 AM
      2 responses
      15 views
      0 likes
      Last Post NinjaTrader_Eduardo  
      Working...
      X