Obviously, this line should update with each price change.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Line on current price
Collapse
X
-
Line on current price
Sorry for such an elementary question, but I am trying to plot a line that shows the last traded price, that goes from the last bar and rightward towards the price display itself, as show in the attached picture. What method would I use to accomplish this? Thanks for any help you can provide.
Obviously, this line should update with each price change.Tags: None
-
Joydeep, thank you for your help. As you can see, this draws the ray through the last two bars.. is there a way to make the ray only draw from the very last bar to the right?Originally posted by NinjaTrader_Joydeep View PostHello JoshDance,
Thanks for writing in and I am happy to assist you.
You can simply draw a ray to accomplish this.
Code:if (CurrentBar > 1) DrawRay("ray", 1, Close[0], 0, Close[0], Color.Blue);
Please let me know if I can assist you any further.
Comment
-
Actually Joydeep, after using this for a few minutes, I notice an issue. With the second piece of code, when I zoom all the way out (I suppose what I really mean is that I reduce the bar spacing as far down as possible), I get the first picture here, where the ray appears vertical. At any other higher bar spacing, it works fine.Originally posted by NinjaTrader_Joydeep View PostHello JoshDance,
Thanks for your note.
Please let me know if I can assist you any further.
How can I check the bar spacing? If I determine it's zero (or whatever the minimum is), then I can use the first piece of code. Else, I'll use the second piece.
Also, given that I have no plots here, how can I allow user input of a color so I can let the user change the color of the ray? I'd prefer not to have three ints for RGB values if possible, I'd like an actual color.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
574 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
333 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
553 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
551 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment