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

  • NinjaTrader_ZacharyG
    replied
    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?

    Leave a comment:


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

    Leave a comment:


  • NinjaTrader_ZacharyG
    replied
    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?

    Leave a comment:


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

    Leave a comment:


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

    Leave a comment:


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

    Leave a comment:


  • NinjaTrader_Bertrand
    replied
    Nothing we could support unfortunately, but you can try using a very high ZOrder level.

    Leave a comment:


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

    Leave a comment:


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

    Leave a comment:


  • onnb1
    replied
    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?


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

    Leave a comment:


  • Mindset
    replied
    Keltner

    try
    this.ZOrder = -1;

    Leave a comment:


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

    Leave a comment:


  • fosch
    replied
    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

    Leave a comment:


  • NinjaTrader_Bertrand
    replied
    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

    Leave a comment:


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

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by funk10101, Today, 09:43 PM
0 responses
6 views
0 likes
Last Post funk10101  
Started by pkefal, 04-11-2024, 07:39 AM
11 responses
37 views
0 likes
Last Post jeronymite  
Started by bill2023, Yesterday, 08:51 AM
8 responses
44 views
0 likes
Last Post bill2023  
Started by yertle, Today, 08:38 AM
6 responses
26 views
0 likes
Last Post ryjoga
by ryjoga
 
Started by algospoke, Yesterday, 06:40 PM
2 responses
24 views
0 likes
Last Post algospoke  
Working...
X