NexusFi: Find Your Edge


Home Menu

 





indicator label how-to


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one vickisb with 6 posts (0 thanks)
    2. looks_two sg72 with 3 posts (3 thanks)
    3. looks_3 EDGE with 2 posts (1 thanks)
    4. looks_4 zt379 with 1 posts (2 thanks)
      Best Posters
    1. looks_one zt379 with 2 thanks per post
    2. looks_two sg72 with 1 thanks per post
    3. looks_3 casey44 with 1 thanks per post
    4. looks_4 EDGE with 0.5 thanks per post
    1. trending_up 2,372 views
    2. thumb_up 7 thanks given
    3. group 6 followers
    1. forum 12 posts
    2. attach_file 6 attachments




 
Search this Thread

indicator label how-to

  #1 (permalink)
 vickisb 
Sarasota FL
 
Experience: Intermediate
Platform: Ninja Trader
Trading: ES
Posts: 59 since Feb 2017
Thanks Given: 36
Thanks Received: 22

I want to blank out indicator labels so they don't display on the chart, but I still want a name to show up in the list of Configured indicators I have applied to my chart. Normally a name is retained, but on some of the custom indicators I have, blanking out the label blanks out the name.

What governs this in the code, and exactly what would I add/change to fix this?

Vicki

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
What broker to use for trading palladium futures
Commodities
MC PL editor upgrade
MultiCharts
Cheap historycal L1 data for stocks
Stocks and ETFs
Better Renko Gaps
The Elite Circle
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
  #2 (permalink)
 
casey44's Avatar
 casey44 
Louisville KY
 
Experience: Beginner
Platform: NT8
Trading: micros
Frequency: Daily
Duration: Minutes
Posts: 249 since Jan 2010
Thanks Given: 4,057
Thanks Received: 315

Not sure if this is what you mean... but in the Indicator / Label window if you put quotation marks around your preferred label name that's what will show up on the chart

Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #3 (permalink)
 sg72 
Orange County, CA, USA
 
Experience: Intermediate
Platform: NinjaTrader, Fidelity ATP
Trading: ES/NQ/RTY, Equity ETFs, Options
Posts: 59 since Sep 2018
Thanks Given: 44
Thanks Received: 48


 
Code
namespace NinjaTrader.NinjaScript.Indicators
{
	public class My_Cool_Indicator : Indicator

		protected override void OnStateChange()
		{
			if (State == State.SetDefaults)
			{
				Description = @"My Cool Indicator does this fancy thing." ;
				Name = "My Cool Indicator" ;
			}
			else if (State == State.Configure)
			{
				this.Name = "" ;

			}
In the code above, when you open up the list of indicators, you'll see "My Cool Indicator" in the list (this comes from the value of Name in State.SetDefaults).
When you click the "i" at the top next to Available, you'll see what's in the Description field.
Setting this.Name to null in State.Configure will prevent the name from showing up at the top left corner of the chart.
After you've added the indicator, next time you go back to the indicators list, you'll see My_Cool_Indicator (from the "class" line) in the list of configured indicators.

I believe this is what you're looking for. I use this all the time to get rid of the ugly long label on the chart.

Reply With Quote
Thanked by:
  #4 (permalink)
 zt379 
UK London
Market Wizard
 
Platform: NT
Posts: 2,079 since Sep 2009
Thanks Given: 1,589
Thanks Received: 1,996


vickisb View Post
I want to blank out indicator labels so they don't display on the chart, but I still want a name to show up in the list of Configured indicators I have applied to my chart. Normally a name is retained, but on some of the custom indicators I have, blanking out the label blanks out the name.

What governs this in the code, and exactly what would I add/change to fix this?

Vicki

If this helps.

You can apply this to each of your indicators.

As an example I've created (attached) a copy of the NT8 EMA indicator adding the code to display, or not, the indicator name while still having the name listed in your configured list.

I've attached it as "EMA No Label NT8.zip" so you can view the code for yourself.



In OnStateChange I added:-

 
Code
DisplayIndicatorName = false;
Note: I set this to "false" so saves unticking the box..(see below)



Just above OnBarUpdate I added:-

 
Code
 public override string DisplayName
{
get { if (State == State.SetDefaults)
return Name;
else if (DisplayIndicatorName)
return Name;
else return ""; }
}


In Properties I added:-

 
Code
[NinjaScriptProperty]
[Display(Name="Show Indicator Name", Description="Draw a symbol to mark change in direction", Order=1, GroupName="Setup")]
public bool DisplayIndicatorName
{ get; set; }
Note: you can chose the GroupName for where in the indicator dialog the tick box will appear. ie "Setup" and you can type in your own Display Name ie: "Show Indicator Name"



The whole code:


 
Code
public class EMANoLabel : Indicator
{
private double constant1;
private double constant2;

protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDe scriptionEMA;
Name = "EMANoLabel";
IsOverlay = true;
IsSuspendedWhileInactive = true;
Period = 14;

///added Display name
DisplayIndicatorName = false;


AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNa meEMA);
}
else if (State == State.Configure)
{
constant1 = 2.0 / (1 + Period);
constant2 = 1 - (2.0 / (1 + Period));
}
}

///added Display Name
public override string DisplayName
{
get { if (State == State.SetDefaults)
return Name;
else if (DisplayIndicatorName)
return Name;
else return "";
}
}

protected override void OnBarUpdate()
{
Value[0] = (CurrentBar == 0 ? Input[0] : Input[0] * constant1 + constant2 * Value[1]);
}

#region Properties
[Range(1, int.MaxValue), NinjaScriptProperty]
[Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
public int Period
{ get; set; }


///Display Indicator Name
[NinjaScriptProperty]
[Display(Name="Show Indicator Name", Description="Draw a symbol to mark change in direction", Order=1, GroupName="Setup")]
public bool DisplayIndicatorName
{ get; set; }


#endregion
}
You'll then get a box you can tick to display or untick to not display the indicator name on the chart:




Hope that helps

Attached Files
Elite Membership required to download: EMA No Label NT8.zip
Reply With Quote
Thanked by:
  #5 (permalink)
 vickisb 
Sarasota FL
 
Experience: Intermediate
Platform: Ninja Trader
Trading: ES
Posts: 59 since Feb 2017
Thanks Given: 36
Thanks Received: 22

Thanks! I added "this.Name = "";" to the State.Configure section and compiled. But now when I type the indicator name back into the label, it is automatically getting blanked out, so again, I still don't have it showing in my list of configured indicators. Not sure what I did wrong...



sg72 View Post
 
Code
namespace NinjaTrader.NinjaScript.Indicators
{
	public class My_Cool_Indicator : Indicator

		protected override void OnStateChange()
		{
			if (State == State.SetDefaults)
			{
				Description = @"My Cool Indicator does this fancy thing." ;
				Name = "My Cool Indicator" ;
			}
			else if (State == State.Configure)
			{
				this.Name = "" ;

			}
In the code above, when you open up the list of indicators, you'll see "My Cool Indicator" in the list (this comes from the value of Name in State.SetDefaults).
When you click the "i" at the top next to Available, you'll see what's in the Description field.
Setting this.Name to null in State.Configure will prevent the name from showing up at the top left corner of the chart.
After you've added the indicator, next time you go back to the indicators list, you'll see My_Cool_Indicator (from the "class" line) in the list of configured indicators.

I believe this is what you're looking for. I use this all the time to get rid of the ugly long label on the chart.


Started this thread Reply With Quote
  #6 (permalink)
 vickisb 
Sarasota FL
 
Experience: Intermediate
Platform: Ninja Trader
Trading: ES
Posts: 59 since Feb 2017
Thanks Given: 36
Thanks Received: 22

Thanks! I will try this if I have to, but what I don't get is why some indicators automatically still display the indicator name in the Configured list when the label is blanked out, while others don't. I've tried to compare code for indicators that behave differently and I can't find the difference.



zt379 View Post
If this helps.

You can apply this to each of your indicators.

As an example I've created (attached) a copy of the NT8 EMA indicator adding the code to display, or not, the indicator name while still having the name listed in your configured list.

I've attached it as "EMA No Label NT8.zip" so you can view the code for yourself.



In OnStateChange I added:-

 
Code
DisplayIndicatorName = false;
Note: I set this to "false" so saves unticking the box..(see below)



Just above OnBarUpdate I added:-

 
Code
 public override string DisplayName
{
get { if (State == State.SetDefaults)
return Name;
else if (DisplayIndicatorName)
return Name;
else return ""; }
}


In Properties I added:-

 
Code
[NinjaScriptProperty]
[Display(Name="Show Indicator Name", Description="Draw a symbol to mark change in direction", Order=1, GroupName="Setup")]
public bool DisplayIndicatorName
{ get; set; }
Note: you can chose the GroupName for where in the indicator dialog the tick box will appear. ie "Setup" and you can type in your own Display Name ie: "Show Indicator Name"



The whole code:


 
Code
public class EMANoLabel : Indicator
{
private double constant1;
private double constant2;

protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDe scriptionEMA;
Name = "EMANoLabel";
IsOverlay = true;
IsSuspendedWhileInactive = true;
Period = 14;

///added Display name
DisplayIndicatorName = false;


AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNa meEMA);
}
else if (State == State.Configure)
{
constant1 = 2.0 / (1 + Period);
constant2 = 1 - (2.0 / (1 + Period));
}
}

///added Display Name
public override string DisplayName
{
get { if (State == State.SetDefaults)
return Name;
else if (DisplayIndicatorName)
return Name;
else return "";
}
}

protected override void OnBarUpdate()
{
Value[0] = (CurrentBar == 0 ? Input[0] : Input[0] * constant1 + constant2 * Value[1]);
}

#region Properties
[Range(1, int.MaxValue), NinjaScriptProperty]
[Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
public int Period
{ get; set; }


///Display Indicator Name
[NinjaScriptProperty]
[Display(Name="Show Indicator Name", Description="Draw a symbol to mark change in direction", Order=1, GroupName="Setup")]
public bool DisplayIndicatorName
{ get; set; }


#endregion
}
You'll then get a box you can tick to display or untick to not display the indicator name on the chart:




Hope that helps


Started this thread Reply With Quote
  #7 (permalink)
 sg72 
Orange County, CA, USA
 
Experience: Intermediate
Platform: NinjaTrader, Fidelity ATP
Trading: ES/NQ/RTY, Equity ETFs, Options
Posts: 59 since Sep 2018
Thanks Given: 44
Thanks Received: 48


vickisb View Post
Thanks! I added "this.Name = "";" to the State.Configure section and compiled. But now when I type the indicator name back into the label, it is automatically getting blanked out, so again, I still don't have it showing in my list of configured indicators. Not sure what I did wrong...

Hi,

Setting this.Name to null string in State.Configure will disable the indicator label on the chart. So regardless of what you type in the Label field in Indicator Properties -> Setup -> Label, you will not get any label on the chart in the top left corner. If you want the ability to set a label on the chart, then you shouldn't null the value of this.Name in your script. But that will have the effect of placing the long label on the chart, which I thought you wanted to avoid.

I guess your use of "configured indicators" is confusing me. When you mention "configured indicators", I'm thinking about the list of indicators that show up in the bottom left panel of Indicator properties dialog. You should still get the indicator name showing up there even if you set this.Name to null string. That name comes from the class definition.

You might want to post this question to Ninja scripting support team. They are extremely knowledgeable and on top of everything. If there is a solution, you have a much better chance of getting your response.

Reply With Quote
  #8 (permalink)
 vickisb 
Sarasota FL
 
Experience: Intermediate
Platform: Ninja Trader
Trading: ES
Posts: 59 since Feb 2017
Thanks Given: 36
Thanks Received: 22


sg72 View Post
Hi,

Setting this.Name to null string in State.Configure will disable the indicator label on the chart. So regardless of what you type in the Label field in Indicator Properties -> Setup -> Label, you will not get any label on the chart in the top left corner. If you want the ability to set a label on the chart, then you shouldn't null the value of this.Name in your script. But that will have the effect of placing the long label on the chart, which I thought you wanted to avoid.

I guess your use of "configured indicators" is confusing me. When you mention "configured indicators", I'm thinking about the list of indicators that show up in the bottom left panel of Indicator properties dialog. You should still get the indicator name showing up there even if you set this.Name to null string. That name comes from the class definition.

You might want to post this question to Ninja scripting support team. They are extremely knowledgeable and on top of everything. If there is a solution, you have a much better chance of getting your response.


See the attached screen pic. When I blank out the label name in Properties (arrow on the right), the indicator name in the list of Configured indicators (arrow on the left) becomes blanked out. This happens when I set this.Name to null string the same as if I blank out the name in Properties manually. I want to blank it out in Properties (so it doesn't appear on the chart) without losing the indicator name in the list of Configured indicators. The perplexing thing is that for some indicators the indicator name doesn't get blanked out, and for some it does, and I can't see where this is controlled in the code.

I reached out to NinjaScripting support already (right before the weekend), but haven't yet heard back.

Thanks!



Started this thread Reply With Quote
  #9 (permalink)
 sg72 
Orange County, CA, USA
 
Experience: Intermediate
Platform: NinjaTrader, Fidelity ATP
Trading: ES/NQ/RTY, Equity ETFs, Options
Posts: 59 since Sep 2018
Thanks Given: 44
Thanks Received: 48


vickisb View Post
See the attached screen pic. When I blank out the label name in Properties (arrow on the right), the indicator name in the list of Configured indicators (arrow on the left) becomes blanked out. This happens when I set this.Name to null string the same as if I blank out the name in Properties manually. I want to blank it out in Properties (so it doesn't appear on the chart) without losing the indicator name in the list of Configured indicators. The perplexing thing is that for some indicators the indicator name doesn't get blanked out, and for some it does, and I can't see where this is controlled in the code.

I reached out to NinjaScripting support already (right before the weekend), but haven't yet heard back.

Thanks!

Thank you for posting the screenshot. Yes, this is what I was referring to also.

It is odd that the name doesn't show up in that list. This has never happened to me and I set this.Name to null string all the time.

Do you have the Name attribute defined and set to some value (not null) in State.SetDefaults?

That's the only thing I can think off. If that doesn't work, I'm afraid I'm out of ideas to try.

I'd be very interested in hearing what Ninja support says. I'd appreciate it if you can share your findings here.

Thank you

Reply With Quote
  #10 (permalink)
 
EDGE's Avatar
 EDGE 
Saint Louis, Mo., USA
 
Experience: Advanced
Platform: NinjaTrader, Tradestation
Broker: Amp/CQG, Velocity/TT, Kinetick, TS
Trading: Anything That Moves..
Frequency: Daily
Duration: Minutes
Posts: 209 since Aug 2010
Thanks Given: 98
Thanks Received: 392



vickisb View Post
See the attached screen pic. When I blank out the label name in Properties (arrow on the right), the indicator name in the list of Configured indicators (arrow on the left) becomes blanked out.


Instead of completely removing the Label text and leaving it blank..

Try placing/using double quotes ( "" ) for the Label text instead...



Best of Luck and Be Safe in this Crazy World!

Reply With Quote




Last Updated on July 7, 2022


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts