#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
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!
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
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:
PHP Code:Tags: None
-
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:
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 #endregion
Ryan M.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by RideMe, 04-07-2024, 04:54 PM
|
6 responses
31 views
0 likes
|
Last Post
by RideMe
Today, 05:31 PM
|
||
Started by tkaboris, Today, 05:13 PM
|
0 responses
2 views
0 likes
|
Last Post
by tkaboris
Today, 05:13 PM
|
||
Started by GussJ, 03-04-2020, 03:11 PM
|
16 responses
3,281 views
0 likes
|
Last Post
by Leafcutter
Today, 04:14 PM
|
||
Started by WHICKED, Today, 12:45 PM
|
2 responses
19 views
0 likes
|
Last Post
by WHICKED
Today, 03:36 PM
|
||
Started by Tim-c, Today, 02:10 PM
|
1 response
10 views
0 likes
|
Last Post Today, 02:52 PM |
Comment