Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
hiding indicator name on screen
Collapse
X
-
Hello ballboy11,
Thanks for your post.
Currently this is only possible by removing the text from the "Label" setting inside your indicators settings. We are tracking interest to have a feature to easily show/hide labels and we are tracking with the ticket ID SFT-3620. I've added a vote on your behalf.
Josh G.NinjaTrader Customer Service
-
-
-
Code:public override string DisplayName //Override display Name { get { return Name; } }
The above will at least show a simplified version of the label(w/o all of the settings), and will populate the text field in the user input screen.
Comment
-
-
If this helps.
As an example I created a copy of the NT8 EMA indicator and added the code for what you want to chose to display or not the indicator name.
I've attached it as "EMA No Label NT8.zip" so you can view the code for yourself.
It's best to first make a copy of the indicator/s you want to edit the code for.
You can always delete the original once you know you've added the code correctly.
In OnStateChange I added:-
Code:DisplayIndicatorName = false;
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; }
The whole code with the additions in green:
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; [B]///added Display name[/B] [COLOR=#27ae60][B]DisplayIndicatorName = false;[/B][/COLOR] AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNa meEMA); } else if (State == State.Configure) { constant1 = 2.0 / (1 + Period); constant2 = 1 - (2.0 / (1 + Period)); } } [B]///added Display Name[/B] [COLOR=#27ae60][B]public override string DisplayName { get { if (State == State.SetDefaults) return Name; else if (DisplayIndicatorName) return Name; else return ""; } }[/B][/COLOR] 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; } [B]///Display Indicator Name[/B] [B][COLOR=#27ae60][NinjaScriptProperty][/COLOR] [COLOR=#27ae60][Display(Name="Show Indicator Name", Description="Draw a symbol to mark change in direction", Order=1, GroupName="Setup")] public bool DisplayIndicatorName { get; set; }[/COLOR][/B] #endregion }
You'll then get a box you can tick to display or untick to not display the indicator name on the chart:
- Likes 1
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by judysamnt7, 03-13-2023, 09:11 AM
|
4 responses
57 views
0 likes
|
Last Post
by DynamicTest
Today, 08:25 PM
|
||
Started by ScottWalsh, Today, 06:52 PM
|
4 responses
36 views
0 likes
|
Last Post
by ScottWalsh
Today, 07:40 PM
|
||
Started by olisav57, Today, 07:39 PM
|
0 responses
7 views
0 likes
|
Last Post
by olisav57
Today, 07:39 PM
|
||
Started by trilliantrader, Today, 03:01 PM
|
2 responses
19 views
0 likes
|
Last Post
by helpwanted
Today, 07:25 PM
|
||
Started by cre8able, Today, 07:24 PM
|
0 responses
9 views
0 likes
|
Last Post
by cre8able
Today, 07:24 PM
|
Comment