Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Drawing text in indicator panel
Collapse
X
-
Drawing text in indicator panel
I draw four horizontal dotted lines in an indicator panel (values 0, 0.5, 1, and 1.5), and I change the colors for each bar depending on price action. I would add to add a label (text) to the left on each of those lines to indicate their function. I would obviously like for the label to remain in the same place (left-most side of the indicator panel) as I scroll through time. How do I do this?Tags: None
-
Hi, unfortunately the suggestion doesn't work for what I am trying to do. I have attached a screen print to show you my indicator (http://www.screencast.com/t/Yjk1MjMwM). As you can see it displays five lines of diamonds. I would like to ask a word of text to the left of those lines of diamond to explain which study the line relates to. DrawText may be the solution and the y value is not a problem, however I don't know how to reference the x/time value to coincide with the left most side of the screen. Thanks in advance for your help.
Comment
-
You have to use DrawTextFixed() if you want it to correspond with left edge as opposed to a certain bar. DrawText() is tied to bars and as you scroll around it will move while DrawTextFixed() is "fixed" onto the chart on certain corners.
If you want it to be "fixed" but at locations of your choosing unfortunately this is not supported and you would have to override the Plot() method and custom program that in yourself.Josh P.NinjaTrader Customer Service
Comment
-
The x-coordinate value for the left side of the screen would be ChartControl.FirstBarPainted, so the value you would use for the startBarsAgo witl be (CurrentBar - ChartControl.FirstBarPainted).
Example:
Since you are going to be using that line a whole lot, you should probably initialize the font in OnStartUp(), after declaring it in the Variables region, and then dispose of the font in OnTermination().Code:int LeftSideOfScreen = ChartControl.FirstBarPainted; DrawText("Test", false, "Text to show at left side of screen", (CurrentBar - LeftSideOfScreen), Close[0], 0, Color.Blue, new Font("Arial" , 12), StringAlignment.Near, Color.Transparent, Color.Transparent, 5);
Be aware that all use of ChartControl functions will not get any support from NT, so use at your own risk. It could change in the future, which I am sure, is partly why they refuse to provide any support for it.
Last edited by koganam; 06-27-2011, 09:37 AM.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
571 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
331 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 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
549 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
549 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment