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.
    JasonNinjaTrader Customer Service

    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.
        JasonNinjaTrader Customer Service

        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 GwFutures1988, Today, 02:48 PM
                    1 response
                    5 views
                    0 likes
                    Last Post NinjaTrader_Clayton  
                    Started by ScottWalsh, 04-16-2024, 04:29 PM
                    6 responses
                    30 views
                    0 likes
                    Last Post ScottWalsh  
                    Started by frankthearm, Today, 09:08 AM
                    10 responses
                    36 views
                    0 likes
                    Last Post frankthearm  
                    Started by mmenigma, Today, 02:22 PM
                    1 response
                    3 views
                    0 likes
                    Last Post NinjaTrader_Jesse  
                    Started by NRITV, Today, 01:15 PM
                    2 responses
                    9 views
                    0 likes
                    Last Post NRITV
                    by NRITV
                     
                    Working...
                    X