• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.


No announcement yet.

Partner 728x90


Changing z order programatically?

  • Filter
  • Time
  • Show
Clear All
new posts


    this.ZOrder = -1;


      Originally posted by NinjaTrader_Bertrand View Post
      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.

      Thanks Bertrand. Is there any plan to add the ability to assign z-order values to individual plots or the whole study with NinjaScript?

      I also see this in the documentation:

      Note: Draw objects originating from a NinjaScript indicator or strategy will all generally share the same z-order as the script. To have the objects on a separate z-order would have to be set programmatically.

      It seams to imply that changing the z-order is possible/supported programmatically. Am I missing something?

      Last edited by onnb1; 03-27-2012, 10:57 PM.


        Onn, no currently that would not be supported - see the other thread of yours I also just replied to. For the draw objects, you designate if the zorder of creating objects would be the same of the indicator study or if they would be separate, you do not assign a concrete zorder level via code.
        BertrandNinjaTrader Customer Service


          How would you ensure indicators are always ON TOP of price bars?


            Nothing we could support unfortunately, but you can try using a very high ZOrder level.
            BertrandNinjaTrader Customer Service


              There is a non-programmatic way to do this. While on the chart, select the object you want to change the ZOrder / Z-index of then hold down the Shift key while scrolling the mouse-wheel. Unfortunately, it needs to be done every time the chart is re-loaded.

              Would be great if it could be saved as part of the template.


                Hello vlc,

                Upon changing the Z-order of your indicators to your liking, you can definitely save this to a chart template that can be reloaded later with all of your indicators, and their Z-orders, saved.

                To do this, you'll want to right-click on the chart and select Templates -> Save As. Name your template to whatever you like and press OK.

                The next time you create a new chart, you'll be able to load up that same template again by selecting it in the "Load the following Chart Template" section.

                For more information about Chart Templates, please take a look at the NinjaTrader help guide at this link: http://ninjatrader.com/support/helpG..._templates.htm

                Please, let us know if we may be of further assistance.
                Zachary G.NinjaTrader Customer Service


                  I wish that worked for me. Maybe some of my indicators are explicitly setting their ZOrder?


                    Hello vlc,

                    Can you please provide a demonstration of the chart template not saving the Z-order settings of your indicators?

                    Here's a simple test you can do:
                    • Create a new chart with your indicators overlayed on top of it and change the Z-Ordering of the indicators.
                    • Save this to a chart template.
                    • Create a new chart with the same template loaded. Change the Z-Ordering around and re-save the template.
                    • Close the new chart. Open another chart, load the template, and compare the older version of your chart template on your previous chart to this new chart with the new version of the template. Has the Z-Ordering changed?
                    Zachary G.NinjaTrader Customer Service


                      Need help!
                      I draw shapes on chart using Graphics object.
                      And I cant get my shapes over bars. ZOrder don't work.
                      But it works only one time if I open new chart and place my indicator on it.
                      Next time after open NT all shapes are under bars.


                        Hello ren37,

                        Thank you for writing in.

                        As a test, can you please see if you are able to reproduce this with the built-in CustomPlotSample indicator?

                        Ensure that you have added this to a chart with Panel set to Same as input series.

                        Save and shutdown NinjaTrader with this indicator applied. When restarting, do you see the same behavior?
                        Zachary G.NinjaTrader Customer Service


                        Latest Posts


                        Topics Statistics Last Post
                        Started by DavidHP, Today, 04:11 PM
                        0 responses
                        1 view
                        Last Post DavidHP
                        by DavidHP
                        Started by alexstox, 03-24-2019, 01:07 PM
                        6 responses
                        Last Post NinjaTrader_PatrickG  
                        Started by fredfred, Today, 11:29 AM
                        3 responses
                        Last Post NinjaTrader_JoshG  
                        Started by swcooke, Today, 10:38 AM
                        3 responses
                        Last Post NinjaTrader_Jesse  
                        Started by rickyblah12, Today, 10:12 AM
                        5 responses
                        Last Post NinjaTrader_ChrisL