• 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

RenderTarget to render in price + indi panels

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

    RenderTarget to render in price + indi panels

    Hello,

    With one single indicator, is it possible to render simultaneously in the price panel and in the indicator panel, by means of the RenderTarget object?

    Thanks

    #2
    Hello cls71,
    Thanks for your post.

    It is possible. However, it is not supported.

    We can leave this forum post open to see if any users have an example of how to do this.
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      Thanks JoshG, If would be possible, would you be so kind as to share a simple script? For example, render a line in the price panel and other line in the indicator panel simultaneously. Thanks in advance.

      Comment


        #4
        cls71,

        This is going to be unsupported. I have no further information.
        Josh G.NinjaTrader Customer Service

        Comment


          #5
          I will share here what I discover ...

          The indicator is loaded in an independent panel and DrawOnPricePanel = true.
          With this code I can access the ChartBars RenderTarget. I thought I could use this RenderTarget to render in the price panel, but it's not like that. Render but without getting to paint in the price panel.

          Apparently, when the OnRender method of the indicator is executed, the price panel is inaccessible (even if you use the RenderTarget from the price panel).

          Code:
            SharpDX.Direct2D1.RenderTarget RTchartbars;
          
            public override void OnRenderTargetChanged()
            {
                      RTchartbars = null;
          
                      foreach(NinjaTrader.Gui.NinjaScript.IChartObject o in ChartControl.ChartObjects )
                      {
                          if (o.Name == "ChartBars")
                          {
                              Dispatcher.InvokeAsync(new Action(() =>
                              {
                                  RTchartbars = o.RenderTarget;
                              }));
                          }
                      }
            }
          
            protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
            {
                      RenderTarget.FillRectangle(new SharpDX.RectangleF(20, 100, 200, 200), Brushes.RoyalBlue.ToDxBrush(RenderTarget));
          
                      if (RTchartbars != null)
                          RTchartbars.FillRectangle(new SharpDX.RectangleF(80, 400, 300, 300), Brushes.Fuchsia.ToDxBrush(RTchartbars));
            }

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by TopGun13, Today, 10:35 PM
          0 responses
          1 view
          0 likes
          Last Post TopGun13  
          Started by Audiofail, Today, 05:40 AM
          6 responses
          18 views
          0 likes
          Last Post willwin
          by willwin
           
          Started by jerblaster23, Today, 03:42 PM
          1 response
          12 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by brian meade, Today, 01:39 PM
          2 responses
          11 views
          0 likes
          Last Post brian meade  
          Started by Johnny Santiago, Today, 12:20 PM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_ChrisL  
          Working...
          X