Announcement

Collapse
No announcement yet.

Color Change

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

  • Color Change

    Is there a generic few lines of code I could add to any indicator plot statements that would change the color of the plot of the line when the line was going up and when it was going down?

  • #2
    momentum
    Here below is an example
    Alex

    PHP Code:

    var vEMA10 = new MAStudy(100"Close"MAStudy.EXPONENTIAL);
    var 
    vLastAlert = -1;

    function 
    preMain() {
        
    setPriceStudy(true);
        
    setStudyTitle("");
        
    setCursorLabelName("10ema"0);
        
    setDefaultBarStyle(PS_SOLID0);
        
    setDefaultBarFgColor(Color.red0);
        
    setDefaultBarThickness(20);
        
    setPlotType(PLOTTYPE_LINE0);
    }

    function 
    main() {
             if (
                
    vEMA10.getValue(MAStudy.MA) > vEMA10.getValue(MAStudy.MA, -1)
            ) 
    onAction1()
             else if (
                
    vEMA10.getValue(MAStudy.MA) < vEMA10.getValue(MAStudy.MA, -1)
            ) 
    onAction2();
     
        return 
    vEMA10.getValue(MAStudy.MA);
    }

        function 
    onAction1() {
            
    setBarFgColor(Color.RGB(0,0,255));
            
    vLastAlert 1;
        }
        function 
    onAction2() {
            
    setBarFgColor(Color.RGB(255,0,0));
            
    vLastAlert 2;
        } 

    Comment


    • #3
      many tx

      Comment

      Working...
      X