![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| General Programming General NinjaScript programming questions. |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Oct 2007
Posts: 333
Thanks: 2
Thanked 12 times in 7 posts
|
As I understand, enum should be placed in a namespace, but for me this is a problem because it doesn't allow versioning : different versions of an indy have to share the same enum, this is very strong coupling.
So what I do is declare enums public in the indicator, so each indicator has its own enum, and no problem with versioning. In the properties, you have to prefix the type with NinjaTrader.Indicator.IndyName Example : Code:
public class TestEnum : Indicator
{
public enum Enum {One, Two, Three};
private Enum myInput0 = Enum.One;
protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
}
protected override void OnBarUpdate()
{
Plot0.Set(Close[0]);
}
[Browsable(false)]
[XmlIgnore()]
public DataSeries Plot0
{
get { return Values[0]; }
}
[GridCategory("Parameters")]
public NinjaTrader.Indicator.TestEnum.Enum MyInput0
{
get { return myInput0; }
set { myInput0 = value; }
}
}
If strategy is unlocked, and '+' replaced with '.', compilation goes OK, but it's not possible to ask end users to do that. Any idea ? |
|
|
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| dynamic enum? | Jim-Boulder | Indicator Development | 10 | 06-28-2011 11:58 AM |
| Ninja Partners/Users discussion? | Flash | Suggestions And Feedback | 1 | 06-25-2010 01:04 PM |
| The Ruler...discussion & suggestions... | Alfred | Version 7 Beta General Questions & Bug Reports | 20 | 04-13-2010 11:12 AM |
| Enum | Mindset | Version 7 Beta General Questions & Bug Reports | 14 | 01-14-2010 11:09 AM |
| Enum Problem | RVRoman | General Programming | 6 | 05-27-2008 12:05 PM |