File Name: CAM_Indicator.efs

Description:
The CAM Indicator For Trends And Countertrends by Barbara Star, PhD

Formula Parameters:

CAM_Indicator.efs

MACD Fast Length: 12
MACD Slow Length: 26
MACD Smoothing: 9
ADX Length: 10
ADX Smoothing: 14
Show CAM UP: true
CAM UP: Green
Show CAM PB: true
CAM PB: Yellow
Show CAM DN: true
CAM DN: Red
Show CAM CT: true
CAM CT: Blue

Notes:
The related article is copyrighted material. If you are not a subscriber
of Stocks & Commodities, please visit www.traders.com.

Download File:
CAM_Indicator.efs


CAM_Indicator.efs


EFS Code:
PHP Code:
/*********************************
Provided By:  
eSignal (Copyright c eSignal), a division of Interactive Data
Corporation. 2016. 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:        
    The CAM Indicator For Trends And Countertrends by Barbara Star, PhD

Version:            1.00  11/07/2017

Formula Parameters:                     Default:
    MACD Fast Length                    12  
    MACD Slow Length                    26  
    MACD Smoothing                      9
    ADX Length                          10
    ADX Smoothing                       14
    Show CAM UP                         true    
    CAM UP                              Green
    Show CAM PB                         true
    CAM PB                              Yellow
    Show CAM DN                         true
    CAM DN                              Red
    Show CAM CT                         true
    CAM CT                              Blue

Notes:
The related article is copyrighted material. If you are not a subscriber
of Stocks & Commodities, please visit www.traders.com.

**********************************/

var fpArray = new Array();
var 
bInit false;
var 
bVersion null;

function 
preMain() {
    
setPriceStudy(true);
    
setShowCursorLabel(false);
    
setColorPriceBars(true);
    
setDefaultPriceBarColor(Color.grey);
    
setStudyTitle("CAM");

    var 
x=0;
    
fpArray[x] = new FunctionParameter("nFastLength"FunctionParameter.NUMBER);
    
with(fpArray[x++]){
        
setName("MACD Fast Length");
        
setLowerLimit(1);        
        
setDefault(12);
    }

    
fpArray[x] = new FunctionParameter("nSlowLength"FunctionParameter.NUMBER);
    
with(fpArray[x++]){
        
setName("MACD Slow Length");
        
setLowerLimit(1);        
        
setDefault(26);
    }

    
fpArray[x] = new FunctionParameter("nSmoothingMACD"FunctionParameter.NUMBER);
    
with(fpArray[x++]){
        
setName("MACD Smoothing");
        
setLowerLimit(1);        
        
setDefault(9);
    }

    
fpArray[x] = new FunctionParameter("nLength"FunctionParameter.NUMBER);
    
with(fpArray[x++]){
        
setName("ADX Length");
        
setLowerLimit(1);        
        
setDefault(10);

    }   

    
fpArray[x] = new FunctionParameter("nSmoothingADX"FunctionParameter.NUMBER);
    
with(fpArray[x++]){
        
setName("ADX Smoothing");
        
setLowerLimit(1);        
        
setDefault(10);
    }

    
fpArray[x] = new FunctionParameter("CAM_UP_shown"FunctionParameter.BOOLEAN);
    
with(fpArray[x++]){
        
setName("Show CAM UP");
        
setDefault(true);
    }

    
fpArray[x] = new FunctionParameter("CAM_UP"FunctionParameter.COLOR);
    
with(fpArray[x++]){
        
setName("CAM UP");
        
setDefault(Color.green);
    }  

    
fpArray[x] = new FunctionParameter("CAM_PB_shown"FunctionParameter.BOOLEAN);
    
with(fpArray[x++]){
        
setName("Show CAM PB");
        
setDefault(true);
    }

    
fpArray[x] = new FunctionParameter("CAM_PB"FunctionParameter.COLOR);
    
with(fpArray[x++]){
        
setName("CAM PB");
        
setDefault(Color.RGB(255,192,0));
    }

    
fpArray[x] = new FunctionParameter("CAM_DN_shown"FunctionParameter.BOOLEAN);
    
with(fpArray[x++]){
        
setName("Show CAM DN");
        
setDefault(true);
    }

    
fpArray[x] = new FunctionParameter("CAM_DN"FunctionParameter.COLOR);
    
with(fpArray[x++]){
        
setName("CAM DN");
        
setDefault(Color.red);
    }   

    
fpArray[x] = new FunctionParameter("CAM_CT_shown"FunctionParameter.BOOLEAN);
    
with(fpArray[x++]){
        
setName("Show CAM CT");
        
setDefault(true);
    }

    
fpArray[x] = new FunctionParameter("CAM_CT"FunctionParameter.COLOR);
    
with(fpArray[x++]){
        
setName("CAM CT");
        
setDefault(Color.blue);
    }    
}

var 
xMACD null;
var 
xADX null;

function 
main(nFastLengthnSlowLengthnSmoothingMACDnLengthnSmoothingADX,
                
CAM_UP_shownCAM_UPCAM_PB_shownCAM_PBCAM_DN_shownCAM_DNCAM_CT_shownCAM_CT) {

    if (
bVersion == nullbVersion verify();
    if (
bVersion == false) return;


    if (!
bInit) {
        
xMACD macd(nFastLengthnSlowLengthnSmoothingMACD);
        
xADX adx(nLengthnSmoothingADX);
        
bInit true;
    }

    var 
nMACD xMACD.getValue(0);
    var 
nADX xADX.getValue(0);
    var 
nMACD_Ref xMACD.getValue(-1);
    var 
nADX_Ref xADX.getValue(-1);

    if (
nMACD_Ref == null || nADX_Ref == null) return;

    if (
nADX >= nADX_Ref &&  nMACD nMACD_Ref && CAM_UP_shown) {
        
setPriceBarColor(CAM_UP);
    }    
    if (
nADX <= nADX_Ref &&  nMACD nMACD_Ref && CAM_PB_shown) {
        
setPriceBarColor(CAM_PB);    
    }    
    if (
nADX >= nADX_Ref &&  nMACD nMACD_Ref && CAM_DN_shown) {
        
setPriceBarColor(CAM_DN);    
    }    
    if (
nADX <= nADX_Ref &&  nMACD nMACD_Ref && CAM_CT_shown) {
        
setPriceBarColor(CAM_CT);    
    }    

    return;
}

function 
verify(){
    var 
false;
    if (
getBuildNumber() < 779){

        
drawTextAbsolute(535"This study requires version 10.6 or later.",
            
Color.whiteColor.blueText.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
            
null13"error");
        
drawTextAbsolute(520"Click HERE to upgrade.@URL=http://www.esignal.com/download/default.asp",
            
Color.whiteColor.blueText.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
            
null13"upgrade");
        return 
b;
    }
    else
        
true;

    return 
b;