Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Z-Order for Drawings

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

    Z-Order for Drawings

    Hi,

    I am drawing a Fib-Extension on the chart, and have the different levels set with varying degrees of opacity. When I draw, the bars on the chart end up 'behind' the drawing, and you can see that the shaded fib levels are on-top of each bar. I would like to have the drawing and shading behind the bars, and I manually do this each time by Shift+Middle Mouse Scrolling on the Fib drawing until it is at the highest level and behind the bars.

    Is there some way to set the default level for a drawing tool, so I do not have to do this over and over all the time? I do this a hundred times a day.

    #2
    Hello DanDaMan,

    Thank you for your post.

    Unfortunately no, it's not currently possible to set a default Z-order for chart objects. However, I have added a vote for you to a current feature request to allow the Z-order of drawing objects to be set as a default. This request is being tracked under the number SFT-2833.

    As with all feature requests, interest is tracked before implementation is considered, so we cannot offer an ETA or promise of fulfillment. If implemented, it will be noted in the Release Notes page of the Help Guide.

    Release Notes — https://ninjatrader.com/support/help...ease_notes.htm

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Hello Kate,
      kindly add my vote (if not already)
      I don’t know the extent of the Feature Request, but some further thoughts in similar vein for consideration - I use OHLC indicators. If, say, price Opens at what is/becomes LOD z-order of which is highest level & thus visible is not ‘configurable’ as far as I can see. Just ponderings/food for thought from experience along the way.

      thanks

      Comment


        #4
        Hello brucerobinson,

        Kate had added your vote.

        Something you may wish to try for drawing drawn from NinjaScript would be to set the ZOrderType property of your drawing object after it is made to control the order it would be drawn. This may not give direct control, but may provide enough functionality to satisfy your ordering requirement. Please note that bars will not have individual ZOrders, each bar in ChartBars would have the same ZOrder.

        Code:
        if (CurrentBar < 5)
            return;
        FibonacciExtensions myFibExt = Draw.FibonacciExtensions(this, "tag1", true, 4, Low[4], 3, High[3], 1, Low[1]);
        //myFibExt.ZOrderType = DrawingToolZOrder.AlwaysDrawnFirst;
        //myFibExt.ZOrderType = DrawingToolZOrder.AlwaysDrawnLast;
        IDrawingTool properties - https://ninjatrader.com/support/help...art_zorder.htm

        More information on ZOrders can be found here - https://ninjatrader.com/support/help...art_zorder.htm

        For manually drawn tools, a copy of the Drawing Tool can be made that sets the ZOrderType in State.SetDefaults.

        Last edited by NinjaTrader_Jim; 03-01-2021, 11:05 AM.
        JimNinjaTrader Customer Service

        Comment


          #5
          Hi _Jim, I have a question regarding manual drawing tools:

          I have a special "Sidi Rectangle" and would like to be able to set the ZOrder. Unfortunately, this here does not work!

          Click image for larger version  Name:	Screenshot_2.jpg Views:	0 Size:	10.3 KB ID:	1184923

          Code:
          [EditorBrowsable(EditorBrowsableState.Always)]
          public class SidiRectangle : Rectangle
          {[INDENT]protected override void OnStateChange()[/INDENT][INDENT]{[/INDENT][INDENT=2]base.OnStateChange();[/INDENT][INDENT=2]if (State == State.SetDefaults)[/INDENT][INDENT=2]{[/INDENT][INDENT=3]Name = "Sidi " + Custom.Resource.NinjaScriptDrawingToolRectangle;[/INDENT][INDENT=3]ShapeType = ChartShapeType.Rectangle;[/INDENT][INDENT=3]// always draw this first
          ZOrderType = DrawingToolZOrder.AlwaysDrawnFirst;[/INDENT][INDENT=2]}[/INDENT][INDENT]}[/INDENT]
           
           }
          Click image for larger version  Name:	Screenshot_1.jpg Views:	0 Size:	5.7 KB ID:	1184922

          ...and this one only works after setting another drawing tool (probably when the chart is renewed?):

          Code:
          [EditorBrowsable(EditorBrowsableState.Always)]
          public class SidiRectangle : Rectangle
          {[INDENT]protected override void OnStateChange()[/INDENT][INDENT]{[/INDENT][INDENT=2]base.OnStateChange();[/INDENT][INDENT=2]if (State == State.SetDefaults)[/INDENT][INDENT=2]{[/INDENT][INDENT=3]Name = "Sidi " + Custom.Resource.NinjaScriptDrawingToolRectangle;[/INDENT][INDENT=3]ShapeType = ChartShapeType.Rectangle;[/INDENT][INDENT=3]ZOrder = -1;[/INDENT][INDENT=2]}[/INDENT][INDENT]}
          
          
          public override void OnRender(ChartControl chartControl, ChartScale chartScale)
          {[/INDENT][INDENT=2]base.OnRender(chartControl, chartScale);[/INDENT][INDENT=2]// Print the currently assigned ZOrder index for this NinjaScript object[/INDENT][INDENT=2]Print("Current ZOrder level is: " + ZOrder);[/INDENT][INDENT=2]ZOrder = -1;[/INDENT][INDENT]}[/INDENT]
           
           }
          Since the object has not yet been completed, the ZOrder will not be adjusted. How can I set the ZOrder here, that it is used from the beginning, when creating the object?

          Click image for larger version  Name:	Screenshot_3.jpg Views:	0 Size:	40.8 KB ID:	1184924

          a short video can be found here => http://www.youtube.com/watch?v=kRhqcOiqzq8
          Last edited by sidlercom80; 01-09-2022, 05:45 AM.
          sidlercom80
          NinjaTrader Ecosystem Vendor - Sidi Trading

          Comment


            #6
            Hello sidlercom80,

            We advise against setting ZOrder directly as noted here and I wouldn't have any suggestion for doing so.

            We would be able to change the ZOrderType, which would specify if we should use the normal Z-Ordering, always first, or always last.

            As for observing the result of setting ZOrderType in a DrawingTool, I have made a short video:

            JimNinjaTrader Customer Service

            Comment


              #7
              Hi _Jim, thank you for your explanation!
              sidlercom80
              NinjaTrader Ecosystem Vendor - Sidi Trading

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Jon17, Today, 04:33 PM
              0 responses
              1 view
              0 likes
              Last Post Jon17
              by Jon17
               
              Started by Javierw.ok, Today, 04:12 PM
              0 responses
              4 views
              0 likes
              Last Post Javierw.ok  
              Started by timmbbo, Today, 08:59 AM
              2 responses
              10 views
              0 likes
              Last Post bltdavid  
              Started by alifarahani, Today, 09:40 AM
              6 responses
              41 views
              0 likes
              Last Post alifarahani  
              Started by Waxavi, Today, 02:10 AM
              1 response
              20 views
              0 likes
              Last Post NinjaTrader_LuisH  
              Working...
              X