#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
[Description("")]
[GridCategory("Parameters")]
public int MyInput0
{
get { return myInput0; }
set { myInput0 = Math.Max(1, value); }
}
#endregion
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Inputs for indicators
Collapse
X
-
Inputs for indicators
I have an indicator written the way I want it, it compiles fine and runs fine, but only as long as it contains this code which was generated when I first created the Indicator:
I have removed all other mentions of 'myInput0" in my code, but if I remove this part, it won't compile. Is it because every indicator MUST have at least 1 input, or is there some way to get rid of this?PHP Code:Tags: None
-
What is the error message? Unfortunately, this code on its own does not mean much in the scheme of things. You can have indicators with no user inputs. In fact, many of the shipping indicators have no inputs (BarTimer, for example).Originally posted by Radical View PostI have an indicator written the way I want it, it compiles fine and runs fine, but only as long as it contains this code which was generated when I first created the Indicator:
I have removed all other mentions of 'myInput0" in my code, but if I remove this part, it won't compile. Is it because every indicator MUST have at least 1 input, or is there some way to get rid of this?PHP Code:#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 [Description("")] [GridCategory("Parameters")] public int MyInput0 { get { return myInput0; } set { myInput0 = Math.Max(1, value); } } #endregion
-
Sorry, I forgot to post what the errors are, there are 2:
Error: "Type expected"
Error: "Invalid token '}' in class, struct, or interface member declaration
To put it into context:
PHP Code:namespace NinjaTrader.Indicator { [Description("")] public class myindicator : Indicator { protected override void Initialize() { } protected override void OnStartUp() { } protected override void OnBarUpdate() { } #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 [Description("")] [GridCategory("Parameters")] // THE myInput0 CODE WOULD START ON THIS LINE #endregion } <---------------THIS is the line that the errors refer to }
Comment
-
You will have to check all your bracketing, to make sure that all open "{" have a corresponding "}". Do not just delete the one that appears to be the extra. The compiler is not very smart about pairing braces, so the indicated brace just means that there is an extra one somewhere in the code. It could be the indicated one, but then again it might not.
Comment
-
That was the first thing I looked for, but I'm positive there aren't any extra brackets anywhere in the indicator. And this doesn't just happen in this indicator--if I go to Tools>New Ninjascript>Indicator>Generate Code (in other words a blank, new indicator) and delete the 'myInput0' bit of code that I'm talking about, I get the same error.
Comment
-
Hi Radical,
It doesn't look like you are using the properties region at all, so you can delete everything below. If you want to keep as placeholder in case you add inputs, can leave the lines starting with #.
Code:#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 [Description("")] [GridCategory("Parameters")] // THE myInput0 CODE WOULD START ON THIS LINE #endregionRyan M.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
579 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
334 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
554 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
551 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment