Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnRender

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

    OnRender

    In NinjaTrader7 it was possible to draw on the price panel from the Plot method of an indicator through Reflection (with the indicator loaded on a new panel).

    However in NinjaTrader8 with DirectX and SharpDX this is not possible.

    Please, could you provide an sample example where an indicator - which is loaded on a new panel - can draw on price panel using the OnRender method ?

    Thanks very much.

    #2
    Hello cls71,

    Thank you for your note.

    There is not a method or object that would allow drawing on a different panel. The issue is that the render target provided to the indicator namespace is clipped to the panel of the indicator.

    You may be able to get around this issue by creating this script as a custom drawing tool instead of as an indicator.

    In NinjaTrader 7, this was also unsupported, however there was a hack to get around this that may no longer work in NinjaTrader 8.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello cls71,

      Thank you for your note.

      There is not a method or object that would allow drawing on a different panel. The issue is that the render target provided to the indicator namespace is clipped to the panel of the indicator.

      You may be able to get around this issue by creating this script as a custom drawing tool instead of as an indicator.

      In NinjaTrader 7, this was also unsupported, however there was a hack to get around this that may no longer work in NinjaTrader 8.

      Are you sure ?
      I can achieve this with only a custom drawing tool?



      All this is drawn by a single indicator which is loaded into its own panel.
      The indicator paints on the price's panel and the indicator's panel, through his Plot method.

      It is not a hack. It's Reflection. A valid resource in .NET environment.
      Attached Files

      Comment


        #4
        Hello cls71,

        I will look into this further and will follow up with you here.
        Zachary G.NinjaTrader Customer Service

        Comment


          #5
          Hello cls71,

          The recommended approach would be for your indicator to call an external DrawingTool to handle all the rendering and setting the indicator's DrawOnPricePanel property to true.

          Please, let us know if we may be of further assistance.
          Zachary G.NinjaTrader Customer Service

          Comment


            #6
            Originally posted by cls71 View Post
            Please, could you provide an sample example where an indicator - which is loaded on a new panel - can draw on price panel using the OnRender method ?
            This seems like it would be a very common situation. Personally, I have an indicator that I need to draw on both its own panel, as well as the price panel.

            It seems the only way to draw on the price panel is via builtin methods such as Draw.Line() and setting the DrawOnPricePanel true or false accordingly.

            However, this causes a tremendous amount of objects to appear in the "Drawing Objects" dialog box. As a user, I would find this very annoying, since any lines that I may have manually added are lost in the mess. This is why I went for the OnRender method (plus, the lines would not be clickable or modifiable), which led me here.

            Is there a way to prevent objects drawn via an indicator from appearing in that list?

            Comment


              #7
              Originally posted by neoikon View Post
              This seems like it would be a very common situation. Personally, I have an indicator that I need to draw on both its own panel, as well as the price panel.

              It seems the only way to draw on the price panel is via builtin methods such as Draw.Line() and setting the DrawOnPricePanel true or false accordingly.

              However, this causes a tremendous amount of objects to appear in the "Drawing Objects" dialog box. As a user, I would find this very annoying, since any lines that I may have manually added are lost in the mess. This is why I went for the OnRender method (plus, the lines would not be clickable or modifiable), which led me here.

              Is there a way to prevent objects drawn via an indicator from appearing in that list?

              Good Question, I've seen other conversations along this topic, but I don't believe there was any solution or at least not one provided.. Would like to be able to do this myself..

              Also, are you sure you can not select, modify, and/or delete an object that was drawn in onrender? I agree that this should not be possible (or at least wasn't in NT7), but at the moment, in B6, I've already reported that this is possible, to both select and delete a RenderTaget.Draw??, and not only can you select/remove/delete the draw object, but this action will remove the indy from the chart without even asking for confirmation.. With that being said, this is a known confirmed issue and is currently being looked at..


              -=Edge=-
              NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

              Comment


                #8
                Originally posted by -=Edge=- View Post
                Also, are you sure you can not select, modify, and/or delete an object that was drawn in onrender?
                I don't know if there is a special situation where this is possible, but if you simply draw a builtin fib retracement on a chart, all the levels are drawn by RenderTarget.DrawLine().

                I'm not able to click those individual lines. Only the main, dashed line, which is the drawing tool itself. Plus, you don't see all those lines appear in the "drawing objects" dialog box. That's the behavior I'm looking for!

                Comment


                  #9
                  Hello neoikon,

                  Originally posted by neoikon View Post
                  Is there a way to prevent objects drawn via an indicator from appearing in that list?
                  Unfortunately, it is not possible to hide drawing objects that were drawn by a Draw method from a script in the Drawing Objects window.

                  The Drawing Objects window pulls from the DrawObjects collection which holds both manually drawn and script generated objects.
                  Zachary G.NinjaTrader Customer Service

                  Comment


                    #10
                    Thank you for the response. That's unfortunate.

                    I hope that NT development understands why this could be an issue and looks to add an option/flag to the objects in the DrawObjects collection when an indicator is drawing them.

                    The alternative is to use RenderTarget.DrawLine() in OnRender(), but this can't be used to draw on a different panel. Hopefully one of the approaches gets a little bump of help. :]

                    Thanks!

                    Comment


                      #11
                      Hello neoikon,

                      I will be forwarding your feature request to product management. We highly value feedback in regards to improving NinjaTrader!
                      Zachary G.NinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by neoikon View Post
                        I don't know if there is a special situation where this is possible, but if you simply draw a builtin fib retracement on a chart, all the levels are drawn by RenderTarget.DrawLine(). I'm not able to click those individual lines. Only the main, dashed line, which is the drawing tool itself. Plus, you don't see all those lines appear in the "drawing objects" dialog box. That's the behavior I'm looking for!
                        I was actually referring to using OnRender in an indicator to RenderTarget.Draw vs that of a drawing tool.. I've posted a specific example with sample code here..




                        -=Edge=-
                        NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

                        Comment


                          #13
                          Originally posted by NinjaTrader_ZacharyG View Post
                          I will be forwarding your feature request to product management. We highly value feedback in regards to improving NinjaTrader!

                          +1


                          -=Edge=-
                          NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

                          Comment


                            #14
                            For drawing complex graphics on the price panel from another panel, we have to know first the location and dimension of the price panel, right? How can we know this in NT8, especially if the price panel is not the top panel (users can push the price panel to panel 2, 3, 4...).

                            By the way, anyone knows if we can use Reflection in WPF?
                            ninZa
                            NinjaTrader Ecosystem Vendor - ninZa.co

                            Comment


                              #15
                              Hello,

                              If you are referring to using SharpDX drawing methods on RenderTarget, those objects will not have a concept of different panels, but will rather draw based upon pixel coordinates of the entire chart canvas.

                              That being said, we currently have clipping logic in place that prevents SharpDX methods from drawing outside of the panel on which the indicator resides. At the present time, it would not be possible to draw these complex graphics on other panels due to the clipping in place, unless you were to obtain the RenderTarget of a separate panel (I'm testing out a possible way to do that now, and I'll post back with any updates).

                              Can you explain a bit more about your goal for using Reflection with WPF? Most or all WPF classes should be fully documented.
                              Dave I.NinjaTrader Product Management

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by alifarahani, Today, 09:40 AM
                              6 responses
                              27 views
                              0 likes
                              Last Post alifarahani  
                              Started by Waxavi, Today, 02:10 AM
                              1 response
                              17 views
                              0 likes
                              Last Post NinjaTrader_LuisH  
                              Started by Kaledus, Today, 01:29 PM
                              5 responses
                              13 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by Waxavi, Today, 02:00 AM
                              1 response
                              12 views
                              0 likes
                              Last Post NinjaTrader_LuisH  
                              Started by gentlebenthebear, Today, 01:30 AM
                              3 responses
                              17 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Working...
                              X