// This namespace holds all indicators and is required. Do not change it. namespace NinjaTrader.Indicator { /// <summary> /// Enter the description of your new custom indicator here /// </summary> [Description("Enter the description of your new custom indicator here")] public class Expiry : Indicator { #region Variables // Wizard generated variables int [] Expiry; // 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() { Expiry = new Int[5]; Add(new Plot(Color.FromKnownColor(KnownClor.Orange), PlotStyle.Dot, "Plot0")); CalculateOnBarClose = false; Overlay = false; PriceTypeSupported =false; Expiry[0] = 20150326; Expiry[1] = 20150226; Expiry[2] = 20150129; Expiry[3] = 20141225; Expiry[4] = 20141127; } /// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { for( int i=0;i<4;i++) { if(ToDay(Time[0]) == Expiry[i]){Plot0.Set(1); break;} else Plot0.Set(0); } }
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
member name error
Collapse
X
-
member name error
Hi please help me resolve error "member names cannot be same as their enclosing type"
HTML Code:Tags: None
-
Hello,
This looks to be caused by a conflict between the class name and one of your variable names.
public class Expiry : Indicator
{
#region Variables
// Wizard generated variables
int [] Expiry;
The Class needs to be unique, this will ultimately be the name of the Indicator, your Variable is the same case and same spelling of Expiry so this would be conflicting.
Please change either the Name of the indicator by changing the Class name, or change Expiry variable to something not conflicting.
I look forward to being of further assistance.JesseNinjaTrader Customer Service
-
Not able to compile even after name change
Originally posted by NinjaTrader_Jesse View PostHello,
This looks to be caused by a conflict between the class name and one of your variable names.
public class Expiry : Indicator
{
#region Variables
// Wizard generated variables
int [] Expiry;
The Class needs to be unique, this will ultimately be the name of the Indicator, your Variable is the same case and same spelling of Expiry so this would be conflicting.
Please change either the Name of the indicator by changing the Class name, or change Expiry variable to something not conflicting.
I look forward to being of further assistance.
Comment
-
Hello,
I looked over the code and created a new indicator from your partial post,
It looks like you have a mis spelling as well as an invalid type.
After you change Expiry to any other name, you will also need to change the line:
Code:Add(new Plot(Color.FromKnownColor([B]KnownClor[/B].Orange), PlotStyle.Dot, "Plot0"));
Code:Add(new Plot(Color.Orange, PlotStyle.Dot, "Plot0"));
Code:Expiry = new Int[5];
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Comment
-
Thanks Jesse please check the following errors
Originally posted by NinjaTrader_Jesse View PostHello,
I looked over the code and created a new indicator from your partial post,
It looks like you have a mis spelling as well as an invalid type.
After you change Expiry to any other name, you will also need to change the line:
Code:Add(new Plot(Color.FromKnownColor([B]KnownClor[/B].Orange), PlotStyle.Dot, "Plot0"));
Code:Add(new Plot(Color.Orange, PlotStyle.Dot, "Plot0"));
Code:Expiry = new Int[5];
I look forward to being of further assistance.
Comment
-
Hello,
Thank you for the image.
This tells us exactly what is wrong based on the error text.
The first error listed says the name "expiry" does not exist which is correct, C# is case sensitive, you have created a variable with the name Expiry not expiry, so you would need to correct the case so they all match.
The next item is the same line, again Int would be invalid as you have Int capitalized. You need to make Int into int with a lowercase I.
The next errors: Plot0 does not exist, this would be related to the public property.
If you expand the region "Properties, if you do not have this segment of code, this would be the reason:
Code:[Browsable(false)] [XmlIgnore()] public DataSeries Plot0 { get { return Values[0]; } }
The errors displayed will always tell you what is happening in the script, if in doubt you can also double click the error to take the cursor to the location of the general error.
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by andrewtrades, Today, 04:57 PM
|
1 response
8 views
0 likes
|
Last Post Today, 05:02 PM | ||
Started by chbruno, Today, 04:10 PM
|
0 responses
6 views
0 likes
|
Last Post
by chbruno
Today, 04:10 PM
|
||
Started by josh18955, 03-25-2023, 11:16 AM
|
6 responses
436 views
0 likes
|
Last Post
by Delerium
Today, 03:42 PM
|
||
Started by FAQtrader, Today, 03:35 PM
|
0 responses
7 views
0 likes
|
Last Post
by FAQtrader
Today, 03:35 PM
|
||
Started by rocketman7, Today, 09:41 AM
|
5 responses
19 views
0 likes
|
Last Post Today, 03:33 PM |
Comment