• 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.
    JoshNinjaTrader 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.
        JoshNinjaTrader 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 ballboy11, Today, 05:22 PM
          0 responses
          3 views
          0 likes
          Last Post ballboy11  
          Started by ballboy11, Today, 04:33 PM
          2 responses
          4 views
          0 likes
          Last Post ballboy11  
          Started by dedouglas, Today, 03:16 PM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by TradeMyth, Today, 02:45 PM
          3 responses
          26 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by Ticnician, Today, 01:46 PM
          1 response
          10 views
          0 likes
          Last Post NinjaTrader_Jim  
          Working...
          X