Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

color background indicator panel

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

    color background indicator panel

    hi,
    i'd like to color the background of the indicator panel.
    therefore i'm using the strategy wizzard and the cci indicator.

    1.) unfortunatly the result is a colorized background of the chart window, but not of the indicator panel. how can i change this?

    2.) how do i have to tell the wizzard to draw a yello background if the indicator moves from -50 to 0 and a grey background if the indicator moves from 50 to -30 for example?

    thanks for your assistance !!

    #2
    Hello,

    Thank you for the question.

    For what you are trying to do this would actually not be possible using the wizard because the wizard is very limited in what you can do regarding indicators.

    Instead for this you would want to create an indicator not using the strategy wizard.

    If you are only using the CCI you could create a copy of the CCI and only modify the code to add your color change condition, this would also allow you to use the correct code to paint in the indicator panel.

    If you would like assistance in this please let me know and I can provide steps on how to make a copy of the CCI and how you would update it.

    For your second question, this would fall back on the information above, the drawing in the wizard would go directly to the chart panel so any condition you create will not plot in the indicators panel specifically.

    I look forward to being of further assistance.

    Comment


      #3
      hi jesse,
      thank you very much.
      how can i copy a system indicator?
      and:
      do i have to change the indicator in a way the nt tutorial shows (http://www.ninjatrader.com/support/h...utorials.htm)?

      Comment


        #4
        Hello,


        For this it would be easiest to copy the system indicator and just use it as a template if this only involves the CCI, to do this please do the following:

        Click Tools -> Edit NinjaScript -> Indicator -> CCI -> Open.

        Once the script editor opens, right click in it and choose Save As.
        Give it a new name and click ok.

        Now the script editor will be loaded with your custom CCI script.

        Before getting into the details on how to do the code, I wanted to check are you asking to check if the value is in between -50 and 0 or when the value physically changes from -50 to the value of 0 between the prior bar and the current bar?

        I look forward to being of further assistance.

        Comment


          #5
          hi jesse,

          great. first step (copy) is already done.

          i'm not sure if i understand your question. but it looks like the second part.
          the idea is: draw a color as long as the cci moves in one direction. than there will be a turning point and from this point (for example +150 till to the next fixed line ( 90 e.g.) draw another color) and than the third color is from +90 until -30.
          for your additional info: at the very end i'd just want to have the colors in the panel, but not the indicator beeing displayed (if possible...?)

          Comment


            #6
            Hello,

            Thank you for the additional information.

            To detect a direction you could potentially check if the current bar is greater than the previous bar, and that the previous bar is greater than 2 bars ago etc.. This would tell you if you are getting a constant direction.

            I will attach a quick example of this to this thread, I would like to explain some portions of the code for better clarity.

            First this statement:

            if(CurrentBar > 3)

            This is telling the portion of code to only run when there are at least 3 bars on the chart, this is needed to prevent errors when looking back 3 bars in the past.

            In the example I have used Value[0] which is referencing the CCI Plot you see on the chart. 0 is the starting index or the current bar, a 1 would be 1 bar ago.

            You will also see the following:

            if(Value[0] > Value[1] && Value[1] > Value[2])

            This statement is checking that the value of the CCI and checking that the current bars value is greater than the value of one bar ago, then it checks if the value of one bar ago is greater than the value of two bars ago. This would be the Rising or up direction.

            The same would go for the down direction just using Less than instead of Greater than.

            else if(Value[0] < Value[1] && Value[1] < Value[2])


            Finally there are 3 additional conditions inside of this main condition which would be for your values where it would change color

            Code:
            if(Value[0] > 90)
            {
                     BackColor = Color.Green;
            }
            if(Value[0] < 90 && Value[0] > -30)
            {
            	BackColor = Color.Yellow;
            }
            if(Value[0] < -30)
            {
            	BackColor = Color.Red;
            }
            This is checking where the value is in relation to the levels you had specified, you could of course modify these to your liking.

            You can import the attached zip as you would normally, the indicator name is CustomCCIExample and you can edit it by going to the Tools -> Edit NinjaScript -> Indicator menu.

            I look forward to being of further assistance.
            Attached Files

            Comment


              #7
              hi jesse,
              thank you very much für your assistance!!
              i'll have a look at it and come back

              Comment


                #8
                attached the over-worked version (just a change in the start condition)
                Attached Files

                Comment


                  #9
                  hi,
                  attached picture shows that not all points are "collected"...
                  what can i do?
                  Attached Files

                  Comment


                    #10
                    Hello Tradexxx,

                    Thank you for your response.

                    This is likely due to the wrapped conditions which involve comparing the values against previous values. Take the conditions that check the value against the static values (90 for example) and place them outside of the values being compared against each other:
                    Code:
                    if(Value[0] > 90)
                    						{
                    							BackColor = Color.Green;
                    						}
                    						if(Value[0] < 90 && Value[0] > -30)
                    						{
                    							BackColor = Color.Yellow;
                    						}
                    						if(Value[0] < -30)
                    						{
                    							BackColor = Color.Red;
                    						}

                    Comment


                      #11
                      what is meant by "place them outside...." ?? (i guess it's not only a displacement...)

                      Comment


                        #12
                        Hello Tradexxx,

                        Thank you for your response.

                        Here is a better example with commenting out the section that may be the cause:
                        Code:
                        					// if(Value[0] > Value[1] && Value[1] > Value[2])
                        					// {
                        						if(Value[0] > 90)
                        						{
                        							BackColor = Color.Green;
                        						}
                        						if(Value[0] < 90 && Value[0] > -30)
                        						{
                        							BackColor = Color.Yellow;
                        						}
                        						if(Value[0] < -30)
                        						{
                        							BackColor = Color.Red;
                        						}
                        					// } 
                        					// else if(Value[0] < Value[1] && Value[1] < Value[2])
                        					// {
                        						if(Value[0] > 90)
                        						{
                        							BackColor = Color.Green;
                        						}
                        						if(Value[0] < 90 && Value[0] > -30)
                        						{
                        							BackColor = Color.Yellow;
                        						}
                        						if(Value[0] < -30)
                        						{
                        							BackColor = Color.Red;
                        						}
                        					// }

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                        0 responses
                        633 views
                        0 likes
                        Last Post Geovanny Suaza  
                        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                        0 responses
                        364 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by Mindset, 02-09-2026, 11:44 AM
                        0 responses
                        105 views
                        0 likes
                        Last Post Mindset
                        by Mindset
                         
                        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                        0 responses
                        567 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by RFrosty, 01-28-2026, 06:49 PM
                        0 responses
                        568 views
                        1 like
                        Last Post RFrosty
                        by RFrosty
                         
                        Working...
                        X