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

Announcement

Collapse
No announcement yet.

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, 05:46 PM.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by benjamind10, Today, 07:27 PM
                              0 responses
                              4 views
                              0 likes
                              Last Post benjamind10  
                              Started by YevhenShynkarenko, Today, 06:07 PM
                              0 responses
                              4 views
                              0 likes
                              Last Post YevhenShynkarenko  
                              Started by StevenNelson, Today, 04:07 PM
                              3 responses
                              11 views
                              0 likes
                              Last Post NinjaTrader_ShawnB  
                              Started by Matthew Spositi, Today, 03:28 PM
                              2 responses
                              8 views
                              0 likes
                              Last Post Matthew Spositi  
                              Started by faisamtrader, Today, 01:30 PM
                              2 responses
                              21 views
                              0 likes
                              Last Post NinjaTrader_ChrisL  
                              Working...
                              X