NinjaTrader Support Forum  
X

Attention!

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


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 09-07-2011, 02:19 AM   #1
gomifromparis
Senior Member
 
Join Date: Oct 2007
Posts: 333
Thanks: 2
Thanked 12 times in 7 posts
Default Another Enum discussion and Strategy problem

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; }
        }
    }
Everything is OK, but there is a problem in the strategy wizard : the Wizard adds a + symbol, and the strategy won't compile.


If strategy is unlocked, and '+' replaced with '.', compilation goes OK, but it's not possible to ask end users to do that.

Any idea ?
Attached Images
File Type: png enum.png (14.1 KB, 8 views)
gomifromparis is offline  
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT -6. The time now is 12:14 AM.