Announcement

Collapse
No announcement yet.

Help with Bar Color

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

  • Help with Bar Color

    This must be simple but I can't figure it out. As an example, the chart attached shows the EFS study has painted bars for those that make 3 higher highs or 3 lower lows in a row. But how do I NOT color all the other bars (shown grey) and keep the standard candle colors for those: red for down and green for up?

    Here's the EFS code:
    function preMain() {
    setPriceStudy(true);
    setStudyTitle("0Test, 3 in a Row");
    setShowCursorLabel(false);
    setDefaultPriceBarColor( Color.grey);
    //setComputeOnClose();
    }

    function main() {

    if (low(-3) > low(-2) && low(-2) > low(-1) && low(-1) > low(0)){
    setPriceBarColor(Color.brown);
    }
    if (high(-3) < high(-2) && high(-2) < high(-1) && high(-1) < high(0)){
    setPriceBarColor(Color.olive);
    }
    return null;
    }
    Attached Files

  • #2
    delete this:

    setDefaultPriceBarColor( Color.grey);

    Comment


    • #3
      Thanks amclister - I tried that but all the grey bars in my pic simply turn to black (that must be default).

      Any other ideas?

      Comment


      • #4
        function preMain() {
        setPriceStudy(true);
        setStudyTitle("0Test, 3 in a Row");
        setShowCursorLabel(false);
        setColorPriceBars(true);
        //setDefaultPriceBarColor( Color.grey);
        //setComputeOnClose();
        }

        function main() {

        if(open(0) > close(0)) {setPriceBarColor(Color.red)}
        if(open(0) < close(0)) {setPriceBarColor(Color.green)}


        if (low(-3) > low(-2) && low(-2) > low(-1) && low(-1) > low(0)){
        setPriceBarColor(Color.brown);
        }
        if (high(-3) < high(-2) && high(-2) < high(-1) && high(-1) < high(0)){
        setPriceBarColor(Color.olive);
        }
        return null;
        }

        Comment


        • #5
          Tried what I suggested first and your right it doesnt work, which is strange as I have built efs that do not just change all bars to black as a default.

          But have checked the other code and it works fine.

          Good luck
          Aengus

          Comment


          • #6
            THANKS Aengus!! That works great!

            Comment

            Working...
            X