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

Input parameter

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

    Input parameter

    Hi,
    For once I am not asking really for help, I want simply to notice that a blank indicator with a single parameter Input can't compile. I will be happy if it is fixed in future versions,

    Thank you,
    R.E.

    #2
    Hello R.E.,

    Thank you for your note. It is no problem asking for help on the forums, that is why we have them! Could you please send me the code for your indicator that will not compile so I can further investigate?

    Thank you in advance.
    Michael M.NinjaTrader Quality Assurance

    Comment


      #3
      Hi,
      here is the code causing the problem.
      I also noticed many errors by the compiler that occurs because of an other error. For example, I compile the code with this problem. The first error the compiler shows me is not about the input doublon but about using Print in the Strategy base.... The line where I use the print is commented so it makes no sense for me. There is many examples of issues like this.

      Thank you in advance,
      R.E.
      Attached Files
      Last edited by snoppss; 08-10-2015, 03:29 AM.

      Comment


        #4
        Hello R.E.,

        Thank you for sending your indicator. The issue with the code you sent me is that "Input" is a reserved name in NinjaScript. You cannot use it because it conflicts with another variable named Input which is hard coded into the program. Please rename your parameter to something else and the code will compile successfully. If you are doing this through code, your code would look something like this:
        Code:
            public class dd : Indicator
            {
                #region Variables
                // Wizard generated variables
                    private int newInput = 1; // Default setting for Input
                // User defined variables (add any user defined variables below)
                #endregion
        
                /// <summary>
                /// This method is used to configure the indicator and is called once before any bar data is loaded.
                /// </summary>
                protected override void Initialize()
                {
                    Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
                    Overlay				= false;
                }
        
                /// <summary>
                /// Called on each bar update event (incoming tick)
                /// </summary>
                protected override void OnBarUpdate()
                {
                    // Use this method for calculating your indicator values. Assign a value to each
                    // plot below by replacing 'Close[0]' with your own formula.
                    Plot0.Set(Close[0]);
                }
        
                #region Properties
                [Browsable(false)]	// this line prevents the data series from being displayed in the indicator properties dialog, do not remove
                [XmlIgnore()]		// this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
                public DataSeries Plot0
                {
                    get { return Values[0]; }
                }
        
                [Description("")]
                [GridCategory("Parameters")]
                public int NewInput
                {
                    get { return newInput; }
                    set { newInput = Math.Max(1, value); }
                }
                #endregion
            }
        Please let me know if you have any questions.
        Michael M.NinjaTrader Quality Assurance

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by helpwanted, Today, 03:06 AM
        1 response
        10 views
        0 likes
        Last Post sarafuenonly123  
        Started by Brevo, Today, 01:45 AM
        0 responses
        7 views
        0 likes
        Last Post Brevo
        by Brevo
         
        Started by aussugardefender, Today, 01:07 AM
        0 responses
        5 views
        0 likes
        Last Post aussugardefender  
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        242 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        9 responses
        385 views
        1 like
        Last Post Gavini
        by Gavini
         
        Working...
        X