• 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

Subscribe to Chart OnRender event from within Add-On

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

    Subscribe to Chart OnRender event from within Add-On

    Hello,

    I'm designing an Add-On to customize the native Chart Window which needs to render custom WPF objects to the chart and update their coordinates during the chart's OnRender event. Can you kindly let me know if 1) This is achievable through the add-on framework? and 2) Can you point me to any examples using a similar method?

    Thank you in advance for your time.


    #2
    Hello CDXTrader,

    It is certainly possible to append items to a chart from an addon however accessing the charts OnRender from that context is not something I could provide any suggestions for. If you develop this as an indicator or script which applies directly to the chart which also naively has OnRender you could certainly use OnRender for other purposes.

    An alternative suggestion would be to avoid using OnRender and instead do something similar to what the DrawingToolTiles indicator does.

    The Indicator DrawingToolTile (included in NT8) makes use of the UserControlCollection along with the mouse events of the chart to control the window instead of using rendering. Depending on what you are trying to use to position the objects you may be able to utilize one of the other events of the chart control. If you can provide some detail on the overall goal and why OnRender would be needed that would help me point a direction better.




    I look forward to being of further assistance.
    Last edited by NinjaTrader_Jesse; 12-06-2019, 09:48 AM.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi Jesse,

      Thank you for the response. What I'm needing to do is place WPF controls (a grid for example) at order prices on a chart and then have those controls remain at the correct price whenever the chart is moved by any means (scrollbar, autoscale, etc.) I'm having difficulty figuring out how to do that without the OnRender event. This project requires an add-on because it will need to continue tracking price data outside of any chart or other app window.

      Adding, removing and moving the WPF objects on the chart seems to work ok. I accomplish that in a similar fashion as the DrawingToolTile as you mentioned. Is there another 'chart move' event that maybe I'm missing that would help me make this happen?

      Thank you.

      Comment


        #4
        Hello CDXTrader,

        Yes from an addon that is not really a use case it would be advised for as you are dealing with the charts events and rendering. Any updates your logic requires would be custom, you could try subscribing to the various events of the ChartControl however from the addons perspective it is not associated with a specific chart to receive specific OnRender updates.

        This project requires an add-on because it will need to continue tracking price data outside of any chart or other app window.
        You can use a lot of the addon code from an indicator, if OnRender is required I would suggest trying to migrate the code into an indicator so it can directly use its override.

        Adding, removing and moving the WPF objects on the chart seems to work ok. I accomplish that in a similar fashion as the DrawingToolTile as you mentioned. Is there another 'chart move' event that maybe I'm missing that would help me make this happen?
        Not specifically for NinjaScript no, you could look at the standard WPF events surrounding the mouse and keyboard to capture dragging or movement. As noted an addon is not expected to deal with rendering or accessing rendering so there are not really any specific events associated with notifying your addon of rendering changes from other areas like a chart.



        I look forward to being of further assistance.



        JesseNinjaTrader Customer Service

        Comment


          #5
          Thanks for the explanation, Jesse.
          That gives me a better understanding of what I'm dealing with between the Add-On and Indicator frameworks.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by sidlercom80, Today, 12:29 PM
          2 responses
          20 views
          0 likes
          Last Post fx.practic  
          Started by itrader46, Today, 02:49 PM
          3 responses
          11 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by m94306, Today, 03:01 PM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_Heath  
          Started by fx.practic, Today, 02:54 PM
          3 responses
          10 views
          0 likes
          Last Post fx.practic  
          Started by MarianApalaghiei, 07-14-2019, 04:00 AM
          5 responses
          62 views
          0 likes
          Last Post koganam
          by koganam
           
          Working...
          X