Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Positioning text using DrawText()
Collapse
X
-
Positioning text using DrawText()
I am drawing an UpArrow on my chart at various locations. I would like to draw text at a fixed distance below the arrow. Can someone tell me how to do this? I am drawing the arrow at Low[0] - .5 * TickSize. If I position the text at a multiple of TickSize such as Low[0] - 2 * TickSize then the distance below the arrow varies depending on how compressed the chart gets when there are large price variations. I would like the text to be a fixed distance below the arrow always. Thanks.Tags: None
-
Please take a look at this syntax version for DrawText()
DrawText(string tag, bool autoScale, string text, int barsAgo, double y, double yPixelOffset, Color textColor, Font font, StringAlignment alignment, Color outlineColor, Color backColor, int opacity)
I think the yPixelOffest parameter can be useful in your case.Josh P.NinjaTrader Customer Service
-
hmm, please explain DrawText() positioning...
I'm using this:
DrawText("ask", false, "Ask: "+askRows[0].Price + " Vol: "+askRows[0].Volume, 0, High[0], 100, Color.Red, font, StringAlignment.Far, Color.Transparent, Color.Transparent, 50);
I want the text to be the X= 5 (five bars back from currentbar), and Y = HighestBar(High, 20) but whenever I use those values I see NO text anywhere. If I plugin the above values they show up ok.
Comment
-
Try this code instead:
The 5 is for the x axis and you want to use the MAX() to find the highest high instead of HighestBar().Code:DrawText("test", false, "Test Text", [B][COLOR=Red]5[/COLOR][/B], [COLOR=Red][B]MAX(High, 20)[0][/B][/COLOR], Color.Red, new Font("Arial", 12), StringAlignment.Far, Color.Transparent, Color.Transparent, 50);Josh P.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
648 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
369 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
108 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
572 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
573 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment