Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Changing z order programatically?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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?

    #2
    Hi JS999, changing this programmatically is not supported at this point in time, but on our feedback list for future consideration.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      Hi JS999, changing this programmatically is not supported at this point in time, but on our feedback list for future consideration.
      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!

      Comment


        #4
        You'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).
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Bertrand View Post
          You'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).
          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!

          Comment


            #6
            Thanks for the additional input, I see - let me forward to product management to add to our list of feedback.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              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


                #8
                That should work from my experience, try setting for example to a really high value like the maxValue for integers - keep in mind it applies to all plots of the indicator, depending on your needs you might need to work with multiples ones.
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  We'ved added your feedback to our lists under # 1003 - thanks again for the input here.
                  BertrandNinjaTrader Customer Service

                  Comment


                    #10
                    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


                      #11
                      Originally posted by fosch View Post
                      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
                      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?

                      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


                        #12
                        Originally posted by fosch View Post
                        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
                        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.
                        BertrandNinjaTrader Customer Service

                        Comment


                          #13
                          Originally posted by SharonSS View Post
                          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?

                          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.
                          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.

                          Have a good weekend,
                          Attached Files
                          BertrandNinjaTrader Customer Service

                          Comment


                            #14
                            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


                              #15
                              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 traderqz, Today, 09:44 AM
                              2 responses
                              4 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by stafe, 04-15-2024, 08:34 PM
                              8 responses
                              40 views
                              0 likes
                              Last Post stafe
                              by stafe
                               
                              Started by rocketman7, Today, 09:41 AM
                              2 responses
                              5 views
                              0 likes
                              Last Post rocketman7  
                              Started by rocketman7, Today, 02:12 AM
                              7 responses
                              31 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by guillembm, Yesterday, 11:25 AM
                              3 responses
                              16 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Working...
                              X