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 > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 12-08-2008, 05:22 PM   #1
NinjaCustomer
Senior Member
 
Join Date: Jan 2008
Posts: 130
Thanks: 0
Thanked 0 times in 0 posts
Default enum problems

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
{
NinjaCustomer is offline  
Reply With Quote
Old 12-08-2008, 06:54 PM   #2
mrlogik
Certified NinjaScript Consultant
 
mrlogik's Avatar
 
Join Date: Sep 2006
Location: New York, USA
Posts: 774
Thanks: 1
Thanked 7 times in 5 posts
Default

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
mrlogik is offline  
Reply With Quote
Old 12-08-2008, 08:42 PM   #3
NinjaCustomer
Senior Member
 
Join Date: Jan 2008
Posts: 130
Thanks: 0
Thanked 0 times in 0 posts
Default

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.
NinjaCustomer is offline  
Reply With Quote
Old 12-09-2008, 02:52 AM   #4
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Default

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.
NinjaTrader_Dierk is offline  
Reply With Quote
Reply

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
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


All times are GMT -6. The time now is 01:15 PM.