Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to draw a rectangle on panels other than the price panel

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

    How to draw a rectangle on panels other than the price panel

    How do I use Draw.Rectangle() to draw on chart panels other than the price panel?

    #2
    Hello goWms,

    Thank you for your post.

    You can use the overload that lets you set DrawOnPricePanel to false. This will draw the rectangle on the indicator panel itself.

    Note that draw objects can only be drawn on the price panel, or the indicator panel.

    Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.


    Draw.Rectangle(NinjaScriptBase owner, string tag, bool isAutoScale, int startBarsAgo, double startY, int endBarsAgo, double endY, Brush brush, Brush areaBrush, int areaOpacity, bool drawOnPricePanel)

    Draw.Rectangle(NinjaScriptBase owner, string tag, bool isAutoScale, DateTime startTime, double startY, DateTime endTime, double endY, Brush brush, Brush areaBrush, int areaOpacity, bool drawOnPricePanel)

    Comment


      #3
      I must be doing something wrong. I cannot even get a rectangle to draw on the price panel. The code I am using in OnBarUpdate() is below:

      // Draw.Rectangle(NinjaScriptBase owner, string tag, bool isAutoScale, int startBarsAgo, double startY, int endBarsAgo, double endY, Brush brush, Brush areaBrush, int areaOpacity, bool drawOnPricePanel)
      Draw.Rectangle(this, "tag", true, 10, High[10], 0, Low[0], Brushes.CornflowerBlue, Brushes.CornflowerBlue, 50, true);

      Perhaps you could send working code that I can look at and see my mistakes.​

      Please advise.

      Thanks,​ Gordon

      Comment


        #4
        Hello,

        Thank you for your post.

        Are you seeing any errors in the Log tab of the Control Center?

        Below is a simple sample script which draws on the indicator panel using this overload:

        Draw.Rectangle(NinjaScriptBase owner, string tag, bool isAutoScale, int startBarsAgo, double startY, int endBarsAgo, double endY, Brush brush, Brush areaBrush, int areaOpacity, bool drawOnPricePanel)
        Attached Files

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        553 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        324 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        100 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        543 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        546 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X