NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 10-26-2009, 07:21 AM   #1
David Lean
Senior Member
 
Join Date: Oct 2009
Location: Australia
Posts: 108
Thanks: 2
Thanked 14 times in 7 posts
Default zOrder, Putting Indicators behind Price.

I'd like my indicators to draw behind the Price bars & not in front.
Is there a way to set this?

NB: I do understand that the order I draw my indicators will implicitly set the zOrder. Similarly if I override the PLOT method the order that I use the graphics.Fill & graphics.Draw will also be "last drawn goes on top".
David Lean is offline  
Reply With Quote
Old 10-26-2009, 07:48 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
Default

David, welcome to the forums, zOrder support will be added with our upcoming NinjaTrader 7 version - http://www.ninjatrader.com/webnew/NT7/NinjaTrader7.html

New Chart Object Paint Ordering (z-order)
As you select any object on a chart, hold down the SHIFT key and scroll with your mouse wheel, you can change the paint layer of the selected object in order to move it in front of or behind other drawn objects. In the image below, the rectangle is selected and is currently on "Level 5 of 5" meaning, it is at the very bottom of the paint order. You could scroll your mouse wheel to "Level 1 of 5" which would put the rectangle on top of all others objects.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 12-16-2009, 01:21 PM   #3
jdfagan
Senior Member
 
Join Date: Feb 2009
Location: Redwood Shores, CA
Posts: 174
Thanks: 0
Thanked 0 times in 0 posts
Default

Bertrand, can we control ZOrder programmatically in NT7 with our indicators?
Last edited by jdfagan; 12-16-2009 at 01:45 PM.
jdfagan is offline  
Reply With Quote
Old 12-16-2009, 01:38 PM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

A single indicator has only one zorder. Any objects drawn from the indicator share the same z-order stacking as the indicator itself.
NinjaTrader_Josh is offline  
Reply With Quote
Old 12-16-2009, 01:40 PM   #5
jdfagan
Senior Member
 
Join Date: Feb 2009
Location: Redwood Shores, CA
Posts: 174
Thanks: 0
Thanked 0 times in 0 posts
Default

Understood, I want to control ZOrder amongst many indicators living on same Chart Panel via code.

For example, using your StrategyPlot capability from a strategy, I can add and control many indicators for that strategy. Using the ZOrder property (e.g., StrategyPlot(0).ZOrder) doesn't seem to work). Only way I can control is by order of when I add an indicator - last one added seems to have top-most ZOrder.
Last edited by jdfagan; 12-16-2009 at 01:45 PM.
jdfagan is offline  
Reply With Quote
Old 12-16-2009, 01:55 PM   #6
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Right. Unfortunately you cant control it by code other than the order in which you are adding it.
NinjaTrader_Josh is offline  
Reply With Quote
Old 03-05-2010, 08:21 AM   #7
sbgtrading
Certified NinjaScript Consultant
 
Join Date: Oct 2007
Location: Northern Illinois
Posts: 256
Thanks: 0
Thanked 3 times in 3 posts
Default

When an indicator draws a trendline, that trendline is always painted UNDER the price bars.

What do we use (programmatically) to push those drawn trendlines to ride on top of the price bars?

Thanks,
Ben
sbgtrading is offline  
Reply With Quote
Old 03-05-2010, 08:57 AM   #8
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
Default

Ben, in NT7 you can control the ZOrder of the drawn objects by the SeparateZOrder property.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 03-05-2010, 09:07 AM   #9
sbgtrading
Certified NinjaScript Consultant
 
Join Date: Oct 2007
Location: Northern Illinois
Posts: 256
Thanks: 0
Thanked 3 times in 3 posts
Default

I see that in the ILine...but the SeparateZOrder property is a boolean value. I assume once you set it to true (meaning you want to separate the ZOrder of that element)...you then have to set the ZOrder numerically (somehow) so that it rides on top of the chart bars?
sbgtrading is offline  
Reply With Quote
Old 03-05-2010, 09:47 AM   #10
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
Default

Ben, you can't set it programmatically - setting this property to true allows you to control the ZOrder of the draw object then manually, see my attached example.
Attached Files
File Type: zip VertLine.zip (1.7 KB, 65 views)
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 03-05-2010, 10:22 AM   #11
sbgtrading
Certified NinjaScript Consultant
 
Join Date: Oct 2007
Location: Northern Illinois
Posts: 256
Thanks: 0
Thanked 3 times in 3 posts
Default

Ok...thanks for the info. So once the line is drawn to the chart (and programmatically set SeparateZOrder = true), then the user will be able to manually change the ZOrder via the scroll-wheel interface.

That answers my question! Thanks again
sbgtrading is offline  
Reply With Quote
Old 03-05-2010, 10:25 AM   #12
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
Default

Quote:
Originally Posted by sbgtrading View Post
...So once the line is drawn to the chart (and programmatically set SeparateZOrder = true), then the user will be able to manually change the ZOrder via the scroll-wheel interface.
Yes, exactly - you open the line's ZOrder up to be independent from the applied indicator, thus it gets it's own ZOrder level on the chart.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 03-06-2010, 11:04 AM   #13
eDanny
Senior Member
 
eDanny's Avatar
 
Join Date: Jul 2008
Location: East Rochester, NY
Posts: 899
Thanks: 0
Thanked 19 times in 17 posts
Default

Are you saying that it will be impossible to programmatically control whether my indicator will be blotted out by price candles? Please find a fix for this as it would be nonsense trying to tell users/customers to manually adjust after applying an indicator to a chart! The end result needs to be user friendly as the very least. Thanks for any consideration.
eDanny is offline  
Reply With Quote
Old 03-28-2010, 07:14 AM   #14
Harry
Senior Member
 
Join Date: Oct 2007
Posts: 1,829
Thanks: 12
Thanked 83 times in 67 posts
Default ZOrder and Chart Templates

Just have a few questions:

(1) ZOrder can be used in the Initialize section of an indicator. What values can ZOrder take? If I set ZOrder = -1, will this draw my indicator behind the candles? What happens if two indicators use ZOrder = -1?

(2) I understand that I can separate the ZOrder of different draw objects within an indicator as per post #10 below.

(3) I understand that a workspace saves the ZOrder manually selected, have tested this -> ok.

(4) However, I found that a chart template will not save the ZOrder. To solve this issue, two solutions are possible

- modify NT7 to include ZOrder with chart templates
- hardcode the ZOrder within the indicator

This comes back to the first question. Can I attach different values for ZOrder in the Initialize() section of an indicator to define the plot order?
Harry is offline  
Reply With Quote
Old 03-29-2010, 05:14 AM   #15
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
Default

Harry, unfortunately setting the direct ZOrder level programmatically is not supported. To avoid conflicting ZOrder level settings, we would advise adjusting your layout as needed and then saving this in a workspace.
NinjaTrader_Bertrand is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
SNAP to price on indicators ssierra Suggestions And Feedback 4 07-01-2010 09:18 AM
ATM not putting target and stop when not connected? badasan ATM Strategies (Discretionary Trading) 12 08-21-2009 03:11 PM
Putting indicator thread to sleep grose Indicator Development 1 02-26-2009 11:21 AM
ATM strategy 7x14tick putting Stop order with 0 contracts devinb ATM Strategies (Discretionary Trading) 5 01-16-2009 10:37 AM
Putting OutputWindow messages into log file xewoox General Programming 1 12-04-2008 09:03 AM


All times are GMT -6. The time now is 11:55 AM.