Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Drawing on panel 2 from strategy

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

    Drawing on panel 2 from strategy

    Hi there!

    I am attempting to draw some lines on the second panel in my strategy, currently attempting this with OnRender as I was unable with regular drawing tools. The second panel is a different instrument to my first panel.
    When I run the following code from one of your help guides:
    Code:
    [COLOR=#0000ff]protected[/COLOR][COLOR=#ffffff] [/COLOR][COLOR=#0000ff]override[/COLOR][COLOR=#ffffff] [/COLOR][COLOR=#0000ff]void[/COLOR][COLOR=#ffffff] [/COLOR]OnRender(ChartControl[COLOR=#ffffff] [/COLOR]chartControl,[COLOR=#ffffff] [/COLOR]ChartScale[COLOR=#ffffff] [/COLOR]chartScale)
    {
    [COLOR=#ffffff]  [/COLOR][COLOR=#008000]// Print the number of panels currently displayed on the chart[/COLOR]
    [COLOR=#ffffff]  [/COLOR]Print(String.Format([COLOR=#800000]"There are {0} panels on the chart"[/COLOR],[COLOR=#ffffff] [/COLOR]chartControl.ChartPanels.Count));[COLOR=#ffffff]  [/COLOR]
    }
    ​
    I am able to display that that I have 2 panels loaded.
    I assumed that I would be able to run the following code to draw on each panel respectively according to their chart index:
    Code:
     if (this.ChartPanel.PanelIndex == 0) // NQ Panel
     {
         RenderTarget.DrawLine(startHighNQ, endHighNQ, brushNQ, 2); // High NQ
         RenderTarget.DrawLine(startLowNQ, endLowNQ, brushNQ, 2); // Low NQ
     }
     if (this.ChartPanel.PanelIndex == 1) // ES Panel
     {
         RenderTarget.DrawLine(startHighES, endHighES, brushES, 2); // High ES
         RenderTarget.DrawLine(startLowES, endLowES, brushES, 2); // Low ES
     }​
    However, this is not the case. Is there another way I can approach accessing PanelIndex 1?

    Thanks in advance

    #2
    Hello kanjy,

    Drawing into multiple panels is not something the strategies OnRender can do, that applies to its panel only. You would have to have a indicator added to the chart into the second panel and then that indicator could draw there. You can find a sample of a strategy that uses indicators for the purpose of drawing in multiple panels here: https://ninjatrader.com/support/help..._a_ninjasc.htm

    Comment


      #3
      Hey Jesse,
      Cool, appreciate the response.
      Cheers,

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      24 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      120 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      63 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      41 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      45 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X