Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Plot Only On Current Bar
Collapse
X
-
Plot Only On Current Bar
I am looking for a way to add a Plot to an indicator that will only plot for the current bar. I do not want to see the historical values from prior bars. Is there a way to do that? For context: I calculate price levels of interest, and I currently draw horizontal lines for those levels in OnRender. That is working well. I also use a 3rd party tool that allows me to use indicator values to launch discretionary orders. I would like to take those same price level calculations and turn them into an indicator (instead of using them to draw lines), but I am only interested in seeing them for the current bar. The 3rd party tool does not allow me to launch orders from a draw object; and I don’t want to use a strategy or an alert to automatically launch orders just because a price level is touched. Any suggestions?
Tags: None
-
Hello jculp,
Thank you for your note.
You could assign a value to the current bar's plot on each bar, and then reset the prior bar's value so it would only plot on the current bar:
So, something like
Value[0] = //your calculation for the current plot goes here
Value.Reset(1);
Please let us know if we may be of further assistance to you.
-
Thanks for the info. I was not familiar with the reset. The sample code from the Help Guide does work as expected. But when I try what you suggest, it doesn't work. If I input any integer for the BarsAgo value, it resets all plots on the chart and none are visible. Am I missing something?
Comment
-
Hello jculp,
Thank you for your reply.
I'm not seeing the same on my end - here's a simple example script. I've just modified the built in SMA indicator to plot a dot on the most recent bar for the SMA Price. Once the SMA has been calculated for the new bar, we reset the prior bar's SMA value so only the most recent is plotted.
Please let us know if we may be of further assistance to you.Attached Files
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