Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Reveal/Alter Default Rectangle Color Attribute

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

    Reveal/Alter Default Rectangle Color Attribute

    Hi

    I have a button that allows me to draw a Rectangle on the chart.
    What I want to do is define the area color for that Rectangle BUT not alter the default value.
    Its just for that one instance.
    Can someone point me in the right direction?

    #2
    Hello Mindset,

    Besides setting the color manually, or changing the "Default" parameters of a rectangle the only other way to change the area color would be with NinjaScript. Did you write the NinjaScript to create a button to draw a rectangle, or are you referring to the Drawing Tools drop down menu at the top of the charting window next to the Bar Styles and Time Period?

    Happy to be of further assistance.
    JCNinjaTrader Customer Service

    Comment


      #3
      Hi
      Yes I have a toolbar button that draws a rectangle ( It just uses SendKeys.Send).
      I can't seem to get any script that will allow a color to be set for that one instance?

      Comment


        #4
        Hello Mindset,

        Using the SendKeys.Send would be the same as using the Hot Key Combination to draw the Rectangle or by clicking on the Draw Rectangle button inside the Drawing Tools drop down menu. In which case you would not be able to specify only one instance of the area color.

        To specify a color you would have to use the DrawRectangle() method.
        JCNinjaTrader Customer Service

        Comment


          #5
          Attribute

          Precisely. But is there not a way to override the Color Attribute/Property that one time?
          So I am simply saying go to the DrawRectangle method but use this color instead.

          Comment


            #6
            Hello Mindset,

            There is not a method that I know of that would change the color of the area color for the next drawing on Draw Rectangle but you can use some custom code to get the Draw Rectangle object inside of a chart and then change the color based upon a condition.

            It would involve using the IDrawObject and IRectangle.

            You may view the following indicator "LineAlert" that uses this method to change the color of a line for reference.
            JCNinjaTrader Customer Service

            Comment


              #7
              Thanks that looks useful. I will play around with it.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by algospoke, 04-17-2024, 06:40 PM
              6 responses
              48 views
              0 likes
              Last Post algospoke  
              Started by arvidvanstaey, Today, 02:19 PM
              4 responses
              11 views
              0 likes
              Last Post arvidvanstaey  
              Started by samish18, 04-17-2024, 08:57 AM
              16 responses
              61 views
              0 likes
              Last Post samish18  
              Started by jordanq2, Today, 03:10 PM
              2 responses
              9 views
              0 likes
              Last Post jordanq2  
              Started by traderqz, Today, 12:06 AM
              10 responses
              21 views
              0 likes
              Last Post traderqz  
              Working...
              X