DisplayName

View as Markdown

Definition

Determines the text display on the chart panel. This is also listed in the UI as the “Label” which can be manually changed (if not overridden). The default behavior of this property will include the NinjaScript type Name along with its input and data series parameters. However this behavior can be overridden if desired.

For modifying the string which is used in the list of available indicators, please see the Name property.

Property Value

A virtual string. This property is read-only.

Syntax

DisplayName

You may choose to override this property using the following syntax:

1public override string DisplayName
2{
3 get { }
4}

Examples

Printing the default DisplayName which displays on the chart label

1protected override void OnStateChange()
2{
3 if (State == State.SetDefaults)
4 {
5 Name = "Example Indicator";
6 }
7}
8
9protected override void OnBarUpdate()
10{
11 Print(DisplayName); //Output: Example Indicator(ES 03-15 (1 Minute))
12}

Overriding the DisplayName to customize the chart label

1protected override void OnStateChange()
2{
3 if (State == State.SetDefaults)
4 {
5 Name = "Example Indicator";
6 }
7}
8
9public override string DisplayName
10{
11 get { return "My Custom Display " + Name; }
12}
13
14protected override void OnBarUpdate()
15{
16 Print(DisplayName); //Output: My Custom Display Example Indicator
17}