File Name: T3_MACO.efs

Description:
T3 MACO

Formula Parameters:
Fast MA : 5
Slow MA : 8
Length MACO : 5
b : 0.7


Notes:


Download File:
T3_MACO.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:        
    T3 MACO
Version:            1.0  09/17/2009
 
Formula Parameters:                     Default:
    Fast MA                             5
    Slow MA                             8
    Length MACO                         5
    b                                   0.7
Notes:
    
**********************************/
var fpArray = new Array();
var 
bInit false;

function 
preMain(){
    
setPriceStudy(false);
    
setShowCursorLabel(true);
    
setShowTitleParameters(false);
    
setStudyTitle("T3 MACO");
    
setCursorLabelName("T3 MACO"0);
    
setPlotType(PLOTTYPE_LINE0);
    
setDefaultBarFgColor(Color.red0);
    var 
0;
    
fpArray[x] = new FunctionParameter("FastMA"FunctionParameter.NUMBER);
    
with(fpArray[x++]) {
        
setName("Fast MA");
        
setLowerLimit(1);
        
setDefault(5);
    }    
    
fpArray[x] = new FunctionParameter("SlowMA"FunctionParameter.NUMBER);
    
with(fpArray[x++]) {
        
setName("SlowMA");
        
setLowerLimit(1);
        
setDefault(8);
    }    
    
fpArray[x] = new FunctionParameter("LengthMACO"FunctionParameter.NUMBER);
    
with(fpArray[x++]) {
        
setName("Length MACO");
        
setLowerLimit(1);
        
setDefault(5);
    }        
    
fpArray[x] = new FunctionParameter("nB"FunctionParameter.NUMBER);
    
with(fpArray[x++]) {
        
setName("b");
        
setLowerLimit(0.0001);
        
setDefault(0.7);
    }            
}

var 
xT3MACO null;

function 
main(SlowMAFastMALengthMACOnB) {
var 
nBarState getBarState();
var 
nT3MACO 0;
    if (
nBarState == BARSTATE_ALLBARS) {
        if(
SlowMA == nullSlowMA 5;
        if(
FastMA == nullFastMA 8;
        if(
LengthMACO == nullLengthMACO 8;
        if(
nB == nullnB 0.7;        
    }
    if (
bInit == false) {
        
addBand(0PS_SOLID1Color.black"Zero");
        
xT3MACO efsInternal("Calc_T3MACO"LengthMACOSlowMAFastMAnB);
        
bInit true;
    }
    
nT3MACO xT3MACO.getValue(0);
    if (
nT3MACO == null) return;
    return 
nT3MACO;
}

var 
bSecondInit false;
var 
xEMA3 null;
var 
xEMA4 null;
var 
xEMA5 null;
var 
xEMA6 null;
var 
c1=0;
var 
c2=0;
var 
c3=0;
var 
c4=0;
var 
b2=0;
var 
b3=0;

function 
Calc_T3MACO(LengthMACOSlowMAFastMAnB) {
var 
nRes 0;
var 
e3=0;
var 
e4=0;
var 
e5=0;
var 
e6=0;
    if (!
bSecondInit) {
        
b2 Math.pow(nB2); 
        
b3 b2 nB;
        
c1 = - b3;
        
c2 = (* (b2 b3));
        
c3 = -* (b2 +  nB b3);
        
c4 = (*  nB b3 b2);
        
xEMA3 ema(LengthMACOema(LengthMACOema(LengthMACOefsInternal("Calc_MA"SlowMAFastMA))));
        
xEMA4 ema(LengthMACOxEMA3);
        
xEMA5 ema(LengthMACOxEMA4);
        
xEMA6 ema(LengthMACOxEMA5);
        
bSecondInit true;
    }
    
e3 xEMA3.getValue(0);
    
e4 xEMA4.getValue(0);
    
e5 xEMA5.getValue(0);
    
e6 xEMA6.getValue(0);
    if (
e6 == null) return;
    
nRes c1 e6 c2 e5 c3 e4 c4 e3;
    return 
nRes;
}

var 
bThridInit false;
var 
xEMAF null;
var 
xEMAS null;

function 
Calc_MA(SlowMAFastMA) {
var 
nRes 0;
var 
nEMAF 0;
var 
nEMAS 0;
    if (!
bThridInit) {
        
xEMAF ema(FastMA);
        
xEMAS ema(SlowMA);
        
bThridInit true;
    }
    
nEMAF xEMAF.getValue(0);
    
nEMAS xEMAS.getValue(0);
    if (
nEMAF == null || nEMAS == null) return;
    
nRes nEMAF nEMAS;
    return 
nRes;