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

Fixed Z-order Script

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

    Fixed Z-order Script

    I want to to set a fixed Z-score for the following drawing tools and indicators:
    • Regional Highlight Y: 6 (OR, all the way in the back)
    • Orderflow Volume Profile (Indicator): 5
    • Horizontal Lines: 3
    • Swing (Indicator): 2
    • Candlesticks (or more specifically OHLC Bars): 1 (OR all the way up front)

    I know a code exists to do this, but I am not a programmer. I know that I can edit code in Ninja Script Editor, but I have no idea where to put the code.

    That said, IF this is possible, please provide the code, and clearly explain exactly where I need to insert it.

    Thanks in advance!

    #2
    Hello rjsjr64,

    Thank you for your post.

    SetZOrder is recommended to use for adjusting the ZOrder for an indicator if you have access to the code for that indicator. If you are drawing objects from an indicator, setting a drawing objects ZOrder property directly will overwrite the assigned ZOrder which is relative to the indicator.

    Note that drawing objects are layered on top of each other in the order drawn within an indicator. If the drawing object is not drawn by an indicator, you would not be able to control the ZOrder of that manually drawn object.

    Please note that there are no supported means for setting a specific fixed ZOrder for indicators that you do not have code access for, such as Order Flow Volume Profile, or for manually drawn objects. You would need to adjust the ZOrder in the indicator itself to control the ZOrder of that indicator or the drawing objects made by that indicator.

    See the help guide documentation below for more information. Also, please see the attached example that demonstrates controlling the ZOrder of a drawing object drawn by an indicator.

    ZOrder - https://ninjatrader.com/support/help...art_zorder.htm
    SetZOrder - https://ninjatrader.com/support/help...?setzorder.htm

    And, see this forum post for more information - https://ninjatrader.com/support/foru...thers-in-front

    Please let us know if we may assist further.
    Attached Files
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      As I said, I'm not a programmer, so 90% of what you just said makes no sense to me.

      So let's keep it simple and forget about indicators. Let's just focus on the Regional Highlight Drawing Tool. I wish for this to be automatically set back to the maximum, so that every other thing on the chart is in front of it.

      What is the code, and where do I place the code?

      Thanks!

      Comment


        #4
        Hello rjsjr64,

        Thank you for your note.

        The Region Highlight drawing tool uses a property called ZOrderType that is set to AlwaysDrawnFirst. This means that the Region Highlight drawing tool will always be drawn first and will appear on top of other objects on the chart. See the video linked below demonstrating this.



        Please let us know if we may assist further.
        Brandon H.NinjaTrader Customer Service

        Comment


          #5
          So, you're saying that the Regional Highlight Tool cannot be modified to be always last?

          Comment


            #6
            Hello rjsjr64,

            Thank you for your note.

            The Region Highlight drawing tool script could be modified to always draw last. To accomplish this, you would need to make a copy of the Region Highlight drawing tool script and edit the ZOrderType property in the script so that it is set to DrawingToolZOrder.AlwaysDrawnLast.

            To make a copy of the script, you would need to open a New > NinjaScript Editor window, double-click the Drawing Tools folder to open it, and select the RegionHighlight script to view the code. Then, you would need to right-click in the code, select Save As, name the copy of the script, and click OK. Please note that this may result in compile errors that need to be resolved.

            After making a copy of the script, you would need to change the ZOrderType property in the OnStateChange() section on line 330 from DrawingToolZOrder.AlwaysDrawnFirst to DrawingToolZOrder.AlwaysDrawnLast.

            See this help guide documentation for more information about the ZOrderType property.
            ZOrderType - https://ninjatrader.com/support/help...zordertype.htm

            Let us know if we may assist further.
            Brandon H.NinjaTrader Customer Service

            Comment


              #7
              Excellent, thank you!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by nightstalker, Today, 02:05 PM
              0 responses
              5 views
              0 likes
              Last Post nightstalker  
              Started by llanqui, Yesterday, 09:59 AM
              8 responses
              28 views
              0 likes
              Last Post llanqui
              by llanqui
               
              Started by quicksandatl, Today, 01:39 PM
              1 response
              3 views
              0 likes
              Last Post quicksandatl  
              Started by md4866, 05-01-2024, 08:15 PM
              2 responses
              18 views
              0 likes
              Last Post md4866
              by md4866
               
              Started by samish18, Today, 12:20 PM
              0 responses
              7 views
              0 likes
              Last Post samish18  
              Working...
              X