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

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 03-15-2009, 02:36 AM   #1
tamas
Senior Member
 
Join Date: Jan 2009
Location: Budapest, HUNGARY
Posts: 258
Thanks: 0
Thanked 0 times in 0 posts
Default Indicator label rename

Hi,

my question would be: if i add indicator in strategy, then can i rename the indicator label in the strategy code (that is seen at the top of the chart)?
tamas is offline  
Reply With Quote
Old 03-15-2009, 08:30 AM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

Try something like

SMA(20).Name = myName;
NinjaTrader_Ray is offline  
Reply With Quote
Old 03-15-2009, 08:44 AM   #3
tamas
Senior Member
 
Join Date: Jan 2009
Location: Budapest, HUNGARY
Posts: 258
Thanks: 0
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by NinjaTrader_Ray View Post
Try something like

SMA(20).Name = myName;
Ohhh, it works much better, because i used this

SMA(20).Plots[0].Name = myName

Thank you Ray
tamas is offline  
Reply With Quote
Old 03-26-2009, 11:33 AM   #4
Mindset
Senior Member
 
Join Date: Mar 2008
Location: UK West Sussex
Posts: 665
Thanks: 9
Thanked 9 times in 7 posts
Default Can you set the label name within an indicator

I see you can do it from a strategy.
Is it possible to set the label in an indicator and if it is could you show the code line?
Mindset is offline  
Reply With Quote
Old 03-26-2009, 11:40 AM   #5
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Something like this? http://www.ninjatrader-support2.com/...ead.php?t=4749
NinjaTrader_Josh is offline  
Reply With Quote
Old 03-26-2009, 02:12 PM   #6
Mindset
Senior Member
 
Join Date: Mar 2008
Location: UK West Sussex
Posts: 665
Thanks: 9
Thanked 9 times in 7 posts
Default Labels everywhere

no the label in the Dialogue Box under General is what I am looking to define.


btw the sample label trim - how does that work anyway? What exactly does the override string method do as my chart shows all 4 parameters?
Mindset is offline  
Reply With Quote
Old 03-26-2009, 02:45 PM   #7
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Mindset,

The sample can trim your label to anything you want. It can rename the label that shows up on the chart, remove inputs from even showing, etc.

The display name will show up as whatever name you name the indicator in the dialogue window though. If you want it to display a different name I suggest you take a look at the TEMA indicator above where it declares the public class.
NinjaTrader_Josh is offline  
Reply With Quote
Old 03-27-2009, 01:05 AM   #8
Mindset
Senior Member
 
Join Date: Mar 2008
Location: UK West Sussex
Posts: 665
Thanks: 9
Thanked 9 times in 7 posts
Default err..

I must be dim.
1. I can't find the TEMA indicator you refer to.
2. the samplelabel trim doesn't do anything. I simply get 4 pieces of text on the chart - the ToString() override doesn't affect what is displayed on the chart in any way
Attached Images
File Type: png ian.png (66.9 KB, 16 views)
Mindset is offline  
Reply With Quote
Old 03-27-2009, 07:13 AM   #9
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

1. Scroll down on your list. It should be there. It is a system indicator.

2. Notice how the sample has four parameters. Then notice how only 1 of the parameters is listed in the header.
Attached Images
File Type: jpg Untitled.jpg (43.9 KB, 17 views)
NinjaTrader_Josh is offline  
Reply With Quote
Old 03-27-2009, 07:53 AM   #10
Mindset
Senior Member
 
Join Date: Mar 2008
Location: UK West Sussex
Posts: 665
Thanks: 9
Thanked 9 times in 7 posts
Default System indicator

I didn't think of that - I spent 20 mins searching all through the forums (lol)
So if you want to have no label you just put:-

Code:
	public override string ToString()
		{
			return " ";
		}
Am I overriding a string object property with this method?
Thanks for the patience.
FYI I will use this with almost every indicator I have as I hate having labels cluttering up my nice clean charts!
Mindset is offline  
Reply With Quote
Old 03-27-2009, 07:59 AM   #11
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Mindset,

That would be correct.
NinjaTrader_Josh 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
Modifying Indicator Label Mike Winfrey Indicator Development 1 09-03-2008 08:07 AM
Rename Indicator mgbloomfield Indicator Development 3 04-17-2008 03:37 PM
Indicator Label Mike Winfrey Indicator Development 3 01-16-2008 11:13 AM
Indicator: Removing and Custom Formatting an Indicator’s Chart Label NinjaTrader_Josh Reference Samples 0 12-30-2007 06:49 PM
Easy way to rename a custom indicator? higler Indicator Development 2 05-19-2007 10:47 AM


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