Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Fancy Rectangle

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

    Fancy Rectangle

    I would like to have a default semi-opaque rectangle display with a height say of 5 ticks (auto-scale) on the chart.
    The rectangle would actually be a horizontal band that always goes from one side of the chart to the other.
    The band would snap to the horizontal tick lines. I would have the ability to reposition this band vertically, ideally with keyboard up/down keys (in combo w/ Ctrl or Alt or something).

    #2
    Hello pdavidow,

    You can manually apply drawing objects to charts, such as a rectangle. More information can be found at the link below.


    Unfortunately the functionalities you describe are not supported. I will forward it to our development team and ask them if they can add this to the list of future considerations for the software.

    Thank you for your feedback.

    Comment


      #3
      Originally posted by NinjaTrader_Jason View Post
      Hello pdavidow,

      You can manually apply drawing objects to charts, such as a rectangle. More information can be found at the link below.


      Unfortunately the functionalities you describe are not supported. I will forward it to our development team and ask them if they can add this to the list of future considerations for the software.

      Thank you for your feedback.
      I tried to create an indicator to overlay a rectangle over the last 200 bar and high (800) and low (0) of the ^TICK index with the following code:

      protectedoverridevoid OnBarUpdate()
      {
      DrawRectangle("Rec1", 200, 0,0, 800, Color.Blue, Color.Blue, 2);
      }

      Not sure why the rectangle doesn't display. Do I need to initialize it or something? Attach a picture of what I am trying to achieve. Can anybody help? Thanks!
      Attached Files

      Comment


        #4
        Hello tjendra,

        I believe the blue section in the attached screenshot is the rectangle.

        Comment


          #5
          I drew that rectangle manually to depict what I want to achieve.
          That was not drawn by the indicator.

          Comment


            #6
            tjendra,

            Please see your Control Center logs. You should have an error there. With your current code you need at least 200 bars before you can call it or else it will throw an error. You can either add a check to ensure you have 200 bars or you can change your draw routine to just draw to the beginning of the chart.

            Option A: Beginning of OnBarUpdate()
            Code:
            if (CurrentBar < 200)
                 return;
            Option B:
            Code:
            DrawRectangle("Rec1", [B][COLOR=Red]CurrentBar[/COLOR][/B], 0, 0, 800, Color.Blue, Color.Blue, 2);
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              It worked now. Thanks for your help Josh!

              Comment


                #8
                Josh,

                If I want to draw the rectangle over an indicator rather than the data value (attach example), how should I modify the functions below?

                DrawRectangle("Rec1", CurrentBar, 50, 0, 100, Color.Blue, Color.Blue, 2);
                DrawRectangle("Rec2", CurrentBar, 0, 0, 50, Color.Red, Color.Red, 2);
                Attached Files

                Comment


                  #9
                  In Initialize() please add DrawOnPricePanel = false.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    Thanks Josh, it worked prefectly now.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by argusthome, 03-08-2026, 10:06 AM
                    0 responses
                    76 views
                    0 likes
                    Last Post argusthome  
                    Started by NabilKhattabi, 03-06-2026, 11:18 AM
                    0 responses
                    45 views
                    0 likes
                    Last Post NabilKhattabi  
                    Started by Deep42, 03-06-2026, 12:28 AM
                    0 responses
                    26 views
                    0 likes
                    Last Post Deep42
                    by Deep42
                     
                    Started by TheRealMorford, 03-05-2026, 06:15 PM
                    0 responses
                    32 views
                    0 likes
                    Last Post TheRealMorford  
                    Started by Mindset, 02-28-2026, 06:16 AM
                    0 responses
                    62 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Working...
                    X