PDA

View Full Version : enum problems


NinjaCustomer
12-08-2008, 05:22 PM
Hi, my indicator code goes something like this... which is a problem of course since the enum is outside the indicator... how do I put it inside the indicator?

for example, if I leave it outside... and have another indicator with the same enum name, there will be compilation problems because of the scope.

public enum Enum1
{
A,B,C
}

// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{

mrlogik
12-08-2008, 06:54 PM
NT uses partial classes, which means they all compile into one main assembly.

I don't *think* you can make the same name enum in different indicators.

NinjaCustomer
12-08-2008, 08:42 PM
ah, I thought it was just because I was a bad programmer.

Reason I wanted to do this was because sometimes I want to take an Indicator I make and save it with another name so that I can make changes to it.

Maybe I had just better learn how to inherit Indicators. That way I can make a new Indicator from my old one and just override what I want to change.

NinjaTrader_Dierk
12-09-2008, 02:52 AM
Just declare your Enum1 as "public" inside the scope of the namespace "NinjaTrader.Indicator" in any indicator file and you can access it easily from any other indicator. It might be worthwhile to consult standard MS docs on C# to understand the namespace concept.