Announcement

Collapse
No announcement yet.

2004 Dec: Trend Trigger Factor

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 2004 Dec: Trend Trigger Factor

    File Name: TrendTriggerFactor.efs

    Description:
    This indicator is from the December 2004 article, Trend Trigger Factor, by M.H. Pee.

    Formula Parameters:
    TTF Length: 15
    TTF Thickness: 2

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


    Download File:
    TrendTriggerFactor.efs



    EFS Code:
    PHP Code:
    /**************
    Provided By : eSignal. (c) Copyright 2004
    Study:        Trend Trigger Factor (TTF) by M.H. Pee
    Version:      1.0

    10/6/2004

    Notes:

    Formula Parameters:                 Default:
    TTF Length                          15
    TTF Thickness                       2
    *************/

    function preMain() {
        
    setStudyTitle("Trend Trigger Factor ");

        
    setCursorLabelName("TTF"0);
        
    setDefaultBarThickness(20);
        
        
    setShowTitleParameters(false);
        
    addBand(100PS_SOLID2Color.red"upper");
        
    addBand(0PS_SOLID2Color.grey"zero");
        
    addBand(-100PS_SOLID2Color.blue"lower");
        
        var 
    fp1 = new FunctionParameter("nLength"FunctionParameter.NUMBER);
        
    fp1.setName("TTF Length");
        
    fp1.setLowerLimit(1);
        
    fp1.setDefault(15);
        
        var 
    fp2 = new FunctionParameter("nThick"FunctionParameter.NUMBER);
        
    fp2.setName("TTF Thickness");
        
    fp2.setLowerLimit(1);
        
    fp2.setDefault(2);
    }

    var 
    bEdit true;
    var 
    nHighBP null;
    var 
    nHighSP null;
    var 
    nLowBP null;
    var 
    nLowSP null;
    var 
    aHigh null;
    var 
    aLow null;
    var 
    nTTF null;

    function 
    main(nLengthnThick) {
        if (
    bEdit == true) {
            
    setDefaultBarThickness(nThick0);
            if (
    aHigh == nullaHigh = new Array(nLength*2);
            if (
    aLow == nullaLow = new Array(nLength*2);
            
    bEdit false;
        }

        var 
    nH high(0);
        var 
    nL low(0);
        
        if (
    getBarState() == BARSTATE_NEWBAR) {
            
    nHighBP null;
            
    nHighSP null;
            
    nLowBP null;
            
    nLowSP null;
            
    aHigh.pop();
            
    aHigh.unshift(nH);
            
    aLow.pop();
            
    aLow.unshift(nL);
            for (
    0< (nLength*2); i++) {
                if (
    == 0) {
                    
    nHighBP aHigh[i];
                    
    nLowSP aLow[i];
                }
                if (
    == nLength) {
                    
    nHighSP aHigh[i];
                    
    nLowBP aLow[i];
                }
                
    // Buy Power High, Sell Power Low
                
    if (nLength) {
                    
    nHighBP Math.max(nHighBPaHigh[i]);
                    
    nLowSP Math.min(nLowSPaLow[i]);
                }
                
    // Buy Power Low, Sell Power High
                
    if (>= nLength) {
                    
    nHighSP Math.max(nHighSPaHigh[i]);
                    
    nLowBP Math.min(nLowBPaLow[i]);
                }
            }
        }

        
    aHigh[0] = nH;
        
    aLow[0] = nL;

        
    nHighBP Math.max(nHighBPaHigh[0]);
        
    nLowSP Math.min(nLowSPaLow[0]);
        
        if (
    close((-nLength*2)) == null) return;
        
        var 
    nBuyPower = (nHighBP nLowBP);
        var 
    nSellPower = (nHighSP nLowSP);
        
    nTTF = ((nBuyPower nSellPower) / (0.5 * (nBuyPower nSellPower))) *100;
        
        
    // Colors
        
    if (nTTF <= -100) {
            
    setBarFgColor(Color.red0);
        } else if (
    nTTF && nTTF > -100) {
            
    setBarFgColor(Color.maroon0);
        } else if (
    nTTF >= && nTTF 100) {
            
    setBarFgColor(Color.navy0);
        } else if (
    nTTF >= 100) {
            
    setBarFgColor(Color.blue0);
        }
        
        return 
    nTTF;

    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation
Working...
X