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

Shading an Area on a CCI Indicator

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

    Shading an Area on a CCI Indicator

    Hello,
    I am looking for help with shading an area on the CCI.
    For example: Shade the area between the +50 and the -50 lines.
    Were I could chose a color and opacity.

    Thanks for any help.

    #2
    dwalls,

    Have you tried using DrawRegion()?
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Hi,
      Thx Josh.
      I have tried this but it wont compile. Any ideas?

      {
      DrawRegion("Shaded 50", CurrentBar, 0, CCI(14)(50), CCI(14)(-50), Color.Empty, Color.Blue, 2);
      }

      Is it close?

      Thanks

      Comment


        #4
        CCI(14)(50), CCI(14)(-50)
        You will need to change these.

        CCI(14)[50]

        Not sure what you want with -50. You cannot access into the future. If you want it to stop painting within 50 bars into the future you can run an if-statement that keeps redrawing it until 50 bars have passed then stops.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Thx Josh,
          I am trying to shade the area between the 50's like in the attached screenshot. I just used the Rectangle tool to draw the shaded area on the screenshot to show you. Dont I need to use [-50] in there some how?

          Thanks
          Attached Files

          Comment


            #6
            You need to input that in differently. You need to use an if-statement to determine that the CCI value is between the 50s.

            Code:
            if (CCI(14)[0] > -50 || CCI(14)[0] < 50)
            You need to determine which range you want to color. Do you want CCI to the -50 line or CCI to the 50 line? It becomes a little funky as the CCI flip flops and that is something you will need to work out on your own.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Thx Josh,
              I think I'm being a little misunderstood.
              It doesnt really matter where the value of the CCI(14) is at.
              It's value would not be a factor in the shading.
              I'm just trying to have a permanent/set shade or color in the area between the +50 line and the -50 line on the CCI indicator, as a colored area/zone of caution for example.

              Does that make sense.

              Thanks for your help.

              Comment


                #8
                Use DrawOnPricePanel = false in Initialize() and then shade the range with the appropriate values.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Thx Josh,
                  I'm having a hard time with this one, its probably simple and its just me.
                  Could you please help me with a code example of how shading a range between two values of an indicator would work.
                  Thanks for your time.

                  Comment


                    #10
                    Please find the attached indicator.
                    Attached Files
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      Thx Josh,
                      Got it to work now.
                      Thank you so much for your help and all you guys do in this forum.

                      dwalls

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by inanazsocial, Today, 01:15 AM
                      1 response
                      5 views
                      0 likes
                      Last Post NinjaTrader_Jason  
                      Started by rocketman7, Today, 02:12 AM
                      0 responses
                      10 views
                      0 likes
                      Last Post rocketman7  
                      Started by dustydbayer, Today, 01:59 AM
                      0 responses
                      1 view
                      0 likes
                      Last Post dustydbayer  
                      Started by trilliantrader, 04-18-2024, 08:16 AM
                      5 responses
                      23 views
                      0 likes
                      Last Post trilliantrader  
                      Started by Davidtowleii, Today, 12:15 AM
                      0 responses
                      3 views
                      0 likes
                      Last Post Davidtowleii  
                      Working...
                      X