Announcement

Collapse
No announcement yet.

color the bars based upon CCI

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

  • color the bars based upon CCI

    Is it possible to color the bars based upon the CCI.

    I'd like to have the bars Lime if the CCI is above 0 and Red if below 0.

    I've attached the CCI Alex help me create.

    Bruce
    Attached Files

  • #2
    Bruce
    Add the following statements in preMain()

    setColorPriceBars(true);
    setDefaultPriceBarColor(Color.black);

    and the following in main() anywhere in between Lines 56 and 65

    if(vCCI.getValue(CCIStudy.CCI)>0)
    setPriceBarColor(Color.lime);
    if(vCCI.getValue(CCIStudy.CCI)<0)
    setPriceBarColor(Color.red);

    Hope this helps
    Alex

    Comment


    • #3
      Alex:

      It worked perfectly....thanks.

      Is it also possible to have the CCI change colors in the same manner.

      I tried copying some code and changing some things but it didn't work.

      Bruce
      Attached Files

      Comment


      • #4
        Bruce
        All you need to do is substitute this

        if(vCCI.getValue(CCIStudy.CCI)>0)
        setPriceBarColor(Color.lime);
        if(vCCI.getValue(CCIStudy.CCI)<0)
        setPriceBarColor(Color.red);

        with this

        if(vCCI.getValue(CCIStudy.CCI)>0){
        setPriceBarColor(Color.lime);
        setBarFgColor(Color.lime);
        }
        if(vCCI.getValue(CCIStudy.CCI)<0){
        setPriceBarColor(Color.red);
        setBarFgColor(Color.red);
        }


        Alex

        Comment


        • #5
          Alex:

          Again, it worked perfectly.

          One last thing, if you don't mind.

          The attached MACD is a single line MACD.

          Is it possible to modify it so it changes colors when the MACD is moving up its Lime and when its moving down its Red.

          Bruce
          Attached Files

          Comment


          • #6
            Bruce
            Substitute Lines 68 through to 68 with the following.

            if(vMACD.getValue(MACDStudy.SIGNAL)>vMACD.getValue (MACDStudy.SIGNAL,-1))
            setBarFgColor(Color.lime,2);
            if(vMACD.getValue(MACDStudy.SIGNAL)<vMACD.getValue (MACDStudy.SIGNAL,-1))
            setBarFgColor(Color.red,2);

            Alex

            Comment


            • #7
              Alex:

              Everything worked great.

              Thanks for much for all your help and Happy Holidays to you and yours.

              Bruce

              Comment


              • #8
                Bruce
                You are most welcome and Happy Holidays to you too.
                Alex

                Comment

                Working...
                X