![]() |
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
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Jan 2008
Posts: 130
Thanks: 0
Thanked 0 times in 0 posts
|
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. Code:
public enum Enum1
{
A,B,C
}
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
|
|
|
|
|
|
#2 |
|
Certified NinjaScript Consultant
Join Date: Sep 2006
Location: New York, USA
Posts: 774
Thanks: 1
Thanked 7 times in 5 posts
|
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.
"You look closely enough, you can find everything has a ... weak spot where it can break, sooner or later"
PureLogikTrading |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Jan 2008
Posts: 130
Thanks: 0
Thanked 0 times in 0 posts
|
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.
Last edited by NinjaCustomer; 12-08-2008 at 08:44 PM.
|
|
|
|
|
|
#4 |
|
Administrator
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
|
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.
Dierk
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| User defined Variables: Font? Enum Pull-Down list? | Lost Trader | General Programming | 20 | 08-30-2010 06:59 AM |
| Optimizing on a user defined parameter (enum) | scjohn | Strategy Analyzer | 1 | 06-13-2008 08:51 AM |
| Enum Problem | RVRoman | General Programming | 6 | 05-27-2008 12:05 PM |
| Custom Enum can be compiled in 6.0, but not in 6.5 | ooppie | General Programming | 3 | 04-24-2008 02:27 AM |
| Indicator: Creating a user-defined parameter type (enum) | NinjaTrader_Josh | Reference Samples | 0 | 09-24-2007 09:12 PM |