Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Changing z order programatically?
Collapse
X
-
Changing z order programatically?
Is there some way to change the z-order of a data series programmatically in NT7? I would like to create an indicator that at the close of every bar, automatically brings the price bars to the top of the z-order, on top of everything else that is painted on the chart. Is there some way to do this in NinjaScript by any chance?Tags: None
-
Thanks for the response... it would be very useful to be able to have a simple indicator like this, so we can keep our charts uncluttered when there are multiple lines that get drawn on them. Hopefully you guys will add it to the next release... thanks again!Originally posted by NinjaTrader_Bertrand View PostHi JS999, changing this programmatically is not supported at this point in time, but on our feedback list for future consideration.
Comment
-
Thanks, that's useful to know... however my real problem is with manually drawn objects. Maybe this same "ZOrder = -1" code can be added to all manually drawn objects as soon as they are drawn, if a particular flag is set on the chart properties. That would allow all fibonnacci levels, trendlines, and so on to automatically appear beneath everything else on the chart the minute they are added, instead of right on top, if the user chooses. Thanks!Originally posted by NinjaTrader_Bertrand View PostYou're welcome, I would agree this can come in handy, for now you can add the unsupported ZOrder = -1 call to your indicators scripts that would move the study behind the price bars (as done in our VolumeZones).
Comment
-
Thanks - incidentally, this unsupported code where we can set ZOrder = -1.... can we also set it to something else to put it always on top of all the other indicators? What would happen if we put a really big number there, like ZOrder = 100? Would it work and just make the indicator topmost, or would it crash because it was trying to set it to a value that was greater than the number of plots on the chart?
Comment
-
Bertrand,
I was just pointed to this thread from Ryan. Handy workaround.
I've started to add the ZOrder = -1 to ALL of my indicators, so that price will always be on top. Could there be any issues in doing this? That is having all ZOrder values equal to -1? What exactly does setting ZOrder to -1 do? Does it just place the indicator "outside" of the ZOrder processing? What if I programmatically set all my ZOrders to like 999? Would there be an issue with multiple indicators having the same ZOrder?
Thanks.
Joe
Comment
-
Doesn't look like you've gotten an answer to your question yet. However, I have a question for you. You said you started adding the ZOorder = -1 to ALL your indicators. Where did you do this? In the property window of the indicator? If so, what area?Originally posted by fosch View PostBertrand,
I was just pointed to this thread from Ryan. Handy workaround.
I've started to add the ZOrder = -1 to ALL of my indicators, so that price will always be on top. Could there be any issues in doing this? That is having all ZOrder values equal to -1? What exactly does setting ZOrder to -1 do? Does it just place the indicator "outside" of the ZOrder processing? What if I programmatically set all my ZOrders to like 999? Would there be an issue with multiple indicators having the same ZOrder?
Thanks.
Joe
Hopefully you're not talking about programming script.
I have a problem with an indicator by PrTester, "Keltner Channel with Color". The first chart I added the Keltner on a 100 Range and it's perfect. However, when I applied it to a 40 Range and 60 Range, the Keltner is ON the bars, not behind the bars like on the 100 Range.
I emailed PrTester about this and he directed me to this thread. ???
I don't want changes to my EMAs as I like them on top of the bars.
Comment
-
Joe, ZOrder = -1 in the Initialize() is an unsupported "trick" to have the bars be on top of that indicator study. You can experiment with setting different ZOrder levels but there would be currently no supported concept for ZOrders across different indicators / scripts - best would be setting the levels for your indicator as needed manually and then saving the complete setup in a workspace file so it could restore properly as you need it the next time you open it.Originally posted by fosch View PostBertrand,
I was just pointed to this thread from Ryan. Handy workaround.
I've started to add the ZOrder = -1 to ALL of my indicators, so that price will always be on top. Could there be any issues in doing this? That is having all ZOrder values equal to -1? What exactly does setting ZOrder to -1 do? Does it just place the indicator "outside" of the ZOrder processing? What if I programmatically set all my ZOrders to like 999? Would there be an issue with multiple indicators having the same ZOrder?
Thanks.
Joe
Comment
-
Sharon, you can set this not the UI but in the Initialize() section of your script. See an example attached, it would direct the SMA plot behind the price bars - this is something you could do for your Keltners as well, but disregard on the EMA's so they stay on top.Originally posted by SharonSS View PostDoesn't look like you've gotten an answer to your question yet. However, I have a question for you. You said you started adding the ZOorder = -1 to ALL your indicators. Where did you do this? In the property window of the indicator? If so, what area?
Hopefully you're not talking about programming script.
I have a problem with an indicator by PrTester, "Keltner Channel with Color". The first chart I added the Keltner on a 100 Range and it's perfect. However, when I applied it to a 40 Range and 60 Range, the Keltner is ON the bars, not behind the bars like on the 100 Range.
I emailed PrTester about this and he directed me to this thread. ???
I don't want changes to my EMAs as I like them on top of the bars.
Have a good weekend,Attached Files
Comment
-
Hi Sharon,
I see that Bertrand got back to you before I could. Anyway, to reiterate what Bertrand said, I placed the code (yes it was NinjaScript) within the Initialize() section of the indicators. I am a programmer, so this was no big deal for me.
I want to point out though, that I am no longer setting the z-orders to -1 in my indicators, as it caused some "odd" behavior. So, I abandoned it. However, with Bertrands response, I will try setting the z-order for each indicator on my charts manual, and see how that works out.
Joe
Comment
-
Strange. I added the ZOrder = -1, and it works when the indicator is applied the first time, but refuses to work the second time. I had removed the Keltner with colors from a 150Range chart, applied the indicator after I had gone in and made the correction and it worked. Then to test it, I removed the indicator, applied, and closed. Opened and put the indicator back on and it wouldn't work.
Here's the correction I made using your example:
///<summary>
/// This method is used to configure the indicator and is called once before any bar data is loaded.
///</summary>
protectedoverridevoid Initialize()
{
Add(new Plot(Color.Blue, "Upper"));
Add(new Plot(Color.Blue, "Lower"));
Add(new Plot(Color.DarkGray, "Midline"));
diff = new DataSeries(this);
Overlay = true;
ZOrder = -1;
PriceTypeSupported = false;
}
So what's wrong that it's not consistent? Maybe because the original one that worked on my 100Range chart is still the original? I didn't mess with that one at all since it was correct from the beginning.
Last edited by SharonSS; 02-26-2012, 06:46 PM.
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
330 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
548 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
548 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment