Announcement

Collapse
No announcement yet.

CCI(10) Color area above 100

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

  • CCI(10) Color area above 100

    CCI(10) Color area above 100
    And color area below -100

    How ? Code ?
    Last edited by larrydudash; 10-24-2011, 10:54 AM.
    Larry Dudash
    HAL at
    http://share.esignal.com/groupconten...r=&groupid=549

  • #2
    Try:
    PHP Code:
    /*********************************************************
    By Alexis C. Montenegro for eSignal © December 2004       
    Use and/or modify this code freely. If you redistribute it
    please include this and/or any other comment blocks and a 
    description of any changes you make.                      
    **********************************************************/
    //added bkgd color
    var fpArray = new Array();

    function 
    preMain() {
        
        
    setPriceStudy(false);
        
    setStudyTitle("CCI");
        
    setCursorLabelName("CCI"0);
        
    setDefaultBarFgColor(Color.blue0);
        
    setPlotType(PLOTTYPE_LINE,0);
        
    setDefaultBarThickness(1,0);
        
    askForInput();
        
        var 
    x=0;
        
    fpArray[x] = new FunctionParameter("Length"FunctionParameter.NUMBER);
        
    with(fpArray[x++]){
            
    setLowerLimit(1);        
            
    setDefault(10);
        }
        
    fpArray[x] = new FunctionParameter("Source"FunctionParameter.STRING);
        
    with(fpArray[x++]){
            
    addOption("open"); 
            
    addOption("high");
            
    addOption("low");
            
    addOption("close");
            
    addOption("hl2");
            
    addOption("hlc3");
            
    addOption("ohlc4"); 
            
    setDefault("close"); 
        }
        
    fpArray[x] = new FunctionParameter("Symbol"FunctionParameter.STRING);
        
    with(fpArray[x++]){
            
    setDefault();
        }
        
    fpArray[x] = new FunctionParameter("Interval"FunctionParameter.STRING);
        
    with(fpArray[x++]){
            
    setDefault();
        }
        
    fpArray[x] = new FunctionParameter("Upper"FunctionParameter.NUMBER);
        
    with(fpArray[x++]){
            
    setDefault(100); 
        }
        
    fpArray[x] = new FunctionParameter("Lower"FunctionParameter.NUMBER);
        
    with(fpArray[x++]){
            
    setDefault(-100); 
        }
        
    fpArray[x] = new FunctionParameter("Params"FunctionParameter.BOOLEAN);
        
    with(fpArray[x++]){
            
    setName("Show Parameters");
            
    setDefault(false);
        }
    }

    var 
    bInit false;
    var 
    xCCI null;

    function 
    main(Length,Source,Symbol,Interval,Upper,Lower,Params) {

        if(
    bInit == false){
            if(
    Symbol == nullSymbol getSymbol();
            if(
    Interval == nullInterval getInterval();
            var 
    vSymbol Symbol+","+Interval;
            
    xCCI cci(Length, eval(Source)(sym(vSymbol)));
            
    xCCI getSeries(xCCI);
            
    addBandUpperPS_SOLID1Color.black,"Upper");
            
    addBandLowerPS_SOLID1Color.black,"Lower");
            
    setShowTitleParameters(eval(Params));
            
    bInit true;
        }
        if(
    xCCI.getValue(0) >= 100setBarBgColor(Color.RGB(204,255,204),0,100,1000);
        if(
    xCCI.getValue(0) <= -100setBarBgColor(Color.RGB(255,240,161),0,-100,-1000);
        return 
    xCCI;

    Wayne

    Comment

    Working...
    X