I have multiple plots in an indicator and wanted to draw a legend that shows what color goes with each plot showing the description in the plot color.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
muli color text
Collapse
X
-
muli color text
Is there any way to have multiple colors in one drawtext or do I need to use multiple drawtext statements?
I have multiple plots in an indicator and wanted to draw a legend that shows what color goes with each plot showing the description in the plot color.Last edited by ct; 12-18-2014, 08:41 AM.Tags: None
-
What you describe sounds more like you want to be able to change the color of the entire text, based on specified conditions. If so, yes, there is an override for DrawText() that allows you to specify the colors.Originally posted by ct View PostIs there any way to have multiple colors in one drawtext or do I need to use multiple drawtext statements?
I have multiple plots in an indicator and wanted to draw a legend that shows what color goes with each plot showing the description in the plot color.
Consult the NT Help for the correct syntax.
Comment
-
I assume you want to make a text colorized the same as its corresponding plot.Originally posted by ct View PostIs there any way to have multiple colors in one drawtext or do I need to use multiple drawtext statements?
I have multiple plots in an indicator and wanted to draw a legend that shows what color goes with each plot showing the description in the plot color.
Please take the color of the plot first:
index = 0 if you want to specify the first-added plot (in the Initialize section)Code:Color plotColor = Plots[index].Pen.Color;
index = 1 if you want to specify the second-added plot (in the Initialize section)
index = 2 if you want to specify the third-added plot (in the Initialize section)
....
Then input it to the DrawText() function, using the long signature:
A sample call is:Code:DrawText(string tag, bool autoScale, string text, int barsAgo, double y, int yPixelOffset, [B]Color plotColor[/B], Font font, StringAlignment alignment, Color outlineColor, Color areaColor, int areaOpacity)
Thanks.Code:DrawText("my tag" + CurrentBar, AutoScale, "text to display", 0, High[0], 0, [B]plotColor[/B], ChartControl.Font, StringAlignment.Near, Color.Transparent, Color.Transparent, 0);
PiLast edited by ninZa; 12-18-2014, 08:46 PM.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
580 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
336 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
103 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
554 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
552 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment