File Name: ErgoticCCI.efs

Description:
Ergotic CCI

Formula Parameters:
Length CCI : 14
pq : 2
pr : 14
ps : 5


Notes:


Download File:
ErgoticCCI.efs



EFS Code:
PHP Code:
/*********************************
Provided By:  
    eSignal (Copyright c eSignal), a division of Interactive Data 
    Corporation. 2009. All rights reserved. This sample eSignal 
    Formula Script (EFS) is for educational purposes only and may be 
    modified and saved under a new file name.  eSignal is not responsible
    for the functionality once modified.  eSignal reserves the right 
    to modify and overwrite this EFS file with each new release.

Description:        
    Ergotic CCI
Version:            1.0  09/17/2009
 
Formula Parameters:                     Default:
    Length CCI                          14
    pq                                  2
    pr                                  14
    ps                                  5
Notes:
    
**********************************/
var fpArray = new Array();
var 
bInit false;

function 
preMain(){
    
setPriceStudy(false);
    
setShowCursorLabel(true);
    
setShowTitleParameters(false);
    
setStudyTitle("Ergotic CCI");
    
setCursorLabelName("CCI"0);
    
setPlotType(PLOTTYPE_LINE0);
    
setDefaultBarFgColor(Color.green0);
    
setCursorLabelName("Ergotic CCI"1);
    
setPlotType(PLOTTYPE_LINE1);
    
setDefaultBarFgColor(Color.red1);
    var 
0;
    
fpArray[x] = new FunctionParameter("pq"FunctionParameter.NUMBER);
    
with(fpArray[x++]) {
        
setLowerLimit(1);
        
setDefault(2);
    }    
    
fpArray[x] = new FunctionParameter("pr"FunctionParameter.NUMBER);
    
with(fpArray[x++]) {
        
setLowerLimit(1);
        
setDefault(14);
    }    
    
fpArray[x] = new FunctionParameter("ps"FunctionParameter.NUMBER);
    
with(fpArray[x++]) {
        
setLowerLimit(1);
        
setDefault(5);
    }    
    
fpArray[x] = new FunctionParameter("LengthCCI"FunctionParameter.NUMBER);
    
with(fpArray[x++]) {
        
setName("Length CCI");
        
setLowerLimit(1);
        
setDefault(14);
    }        
}

var 
xCCI null;
var 
xEMA2MomAbs null;
var 
xEMA2Mom null;

function 
main(LengthCCIpqprps) {
var 
nBarState getBarState();
var 
nEMAMom 0;
var 
nEMAMomAbs 0;
var 
nCCI 0;
var 
nErgoticCCI 0;
    if (
nBarState == BARSTATE_ALLBARS) {
        if(
LengthCCI == nullLengthCCI 14;
        if(
pq == nullpq 2;
        if(
pr == nullpr 14;
        if(
ps == nullps 5;
    }
    if (
bInit == false) {
        
addBand(0PS_SOLID1Color.black"Zero");
        
xCCI cci(LengthCCIhlc3());
        
xEMA2Mom ema(psema(prema(pqmom(1))));
        
xEMA2MomAbs ema(psema(prema(pqefsInternal("Calc_MomAbs"))));
        
bInit true;
    }
    
nEMAMom xEMA2Mom.getValue(0);
    
nEMAMomAbs xEMA2MomAbs.getValue(0);
    
nCCI xCCI.getValue(0);
    if (
nEMAMom == null || nEMAMomAbs == null || nCCI == null) return;
    if (
nEMAMomAbs != 0) {
        
nErgoticCCI = (450 nEMAMom) / nEMAMomAbs;
    } else return;
    return new Array(
nCCInErgoticCCI);
}

var 
xMom2 null;
var 
bSecondInit false;

function 
Calc_MomAbs() {
var 
nRes 0;
    if (!
bSecondInit) {
        
xMom2 mom(1);
        
bSecondInit true;
    }
    
nRes Math.abs(xMom2.getValue(0));
    if (
nRes == null) return;
    return 
nRes;