Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
the "Visible" checkbox for plots
Collapse
X
-
the "Visible" checkbox for plots
Hi, I am trying to recreate the basic function of the Visible checkbox seen in indicators like EMA which can toggle on/off the plot visibility while retaining the plot color. Past related posts have suggested making plot bars transparent but such loses the plot color if the workspace is saved then reopened later. Can you please direct me to documentation describing the visible property for plots if such exists, or alternatively indicate how one accesses the Visible checkbox via code. Thanks.Tags: None
-
Hello REI140205,
Thank you for your post.
A public bool NinjaScript Property could be used to toggle the color of a plot. First, you would create a public bool NinjaScript Property (initially set to true) in the Properties section of your script. Then, in OnBarUpdate you would add a condition that checks if the bool is false followed by changing the brush color of the plot to transparent. This means that if you uncheck the bool in the Indicator's Properties section, the indicator plot will display as transparent.
Below is the help guide documentation for Plots, Brushes, and working with NinjaScript Properties.
Plots - https://ninjatrader.com/support/help.../nt8/plots.htm
Brushes - https://ninjatrader.com/support/help...th_brushes.htm
NinjaScript Properties - https://ninjatrader.com/support/help...yattribute.htm
Please see the attached example script which demonstrates this.
Let us know if you have further questions.Attached Files<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
-
Thanks Brandon. With your indicator can you please confirm that you get the same behavior I do?
1. initial condition starts with plot on chart = true and the plot appears as red (as expected).
2. go into the ui and toggle plot on chart = false and hit ok to exit ui menu ... plot no longer appears on chart (again as expected)
3. now go back to ui menu and toggle plot on chart = true ... plot color is now transparent (original plot color of red is lost, so undesired result)
I was looking documentation for how to retain the color, so that one could have (for example) multiple plots from one indicator and then simply selectively toggle which ones show for whatever reason at different times. The visible checkbox for built-in indicators like EMA behave differently because the original plot brush is retained, but I suspect its Visible checkbox affects the whole indicator so one might not be able to control each plot separately. However, I understand objects like lines have a visible checkbox so wonder if plots have similar inherent capability.
Thanks.
Comment
-
Hello REI140205,
The behavior you notice is expected from the indicator shared by Brandon. For what you need, I've modified this indicator so you can retain the plot color. Here you get it.
TriggerPlotTransparent.zip
Comment
-
Hello REI140205,
Thank you for your note.
The behavior you are seeing is expected as stated by s.kinra. Instead of using Plots[0].Brushes in the script, you would need to use PlotBrushes[0][0] to change the color of the indicator when toggling the bool as seen in s.kinra's example.
Please see this help guide link about PlotBrushes for more information - https://ninjatrader.com/support/help...lotbrushes.htm
Let us know if we may assist further.<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
Comment
-
Thanks ... another related question: once plotted using PlotBrushes[0][0] (say using red), can the plot brush be changed and the plot updated at any time via code like:
for (int i = 0; i < CurrentBar; i++)
{
PlotBrushes[0][i] = Brushes.Yellow;
}
Via a button or menu click, I got Plot[0].Brushes to work in my indicator to permit the plot color to be changed whenever desired (without needing to open the ui menu), then did a workaround to preserve the last setting upon workspace closing. I could only get PlotBrushes[0][0] to work upon initial indicator load/reload (i.e., ui menu interaction required).
Comment
-
Hello REI 140205,
Thank you for your note.
Please see the attached example that demonstrates how you could change the color of a plot when a button is clicked. In the example script, we create a button that is placed on the chart and when the button is clicked, the color of the plot is changed to yellow. When the button is clicked again, the plot color changes back to red.
To accomplish this our script checks to see if the button was clicked followed by using the code snippet you provided to loop through the bars and change the plot color to yellow. Then our script checks if the button is not pressed and loops through the bars again to change the plot color back to red.
Also, see the help guide documentation linked below for more information.
Please let us know if you have further questions.
Attached Files<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
- Likes 1
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
576 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
334 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