Announcement

Collapse
No announcement yet.

2004 Aug: AdvanceIssuesMom.efs

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

  • 2004 Aug: AdvanceIssuesMom.efs

    File Name: AdvanceIssuesMom.efs

    Description:
    This formula is based on Boosting Profitability by Lawrence Chan and Louis Lin. This article appeared in the August 2004 issue of Stock & Commodities.

    Formula Parameters:
    Momentum Length - 20
    Symbol 1 - $BANK - Nasdaq Banking
    Symbol 2 - $NBI - Nasdaq Biotech
    Symbol 3 - $IXCO - Nasdaq Computer
    Symbol 4 - $IXF - Nasdaq Financial
    Symbol 5 - $IXTC - Nasdaq Telecommunications
    Symbol 6 - NA
    Symbol 7 - NA

    Notes:
    eSignal Advanced charts has a symbol limit of 7. Therefore the maximum limit for the basket of symbols to include in the Advance Issues Momentum study is 7. The default basket of symbols is currently set to $BANK (Nasdaq Banking), $NBI (Nasdaq Biotech), $IXCO (Nasdaq Computer), $IXF (Nasdaq Financial) and $IXTC (Nasdaq Telecommunications). Due to the restricted number of symbols there is also a small modification to the trading signals that requires the AIM number to be less than or equal to half of the total number of symbols to enter a long position. The article uses a ratio equal to two thirds, which was a bit too restrictive for a smaller number of symbols. The study is compatible with the Strategy Analyzer for back testing as well as real time usage. The related article is copyrighted material. If you are not a subscriber of Stocks & Commodities, please visit www.traders.com.


    Download File:
    AdvanceIssuesMom.efs



    EFS Code:
    PHP Code:
    /*****************************************************************
    Provided By : eSignal. (c) Copyright 2004
    Study:        Advance Issues Momentum by Lawrence Chan and Louis Lin
    Version:      1.0

    6/7/2004

    Notes:
    Due to the EFS symbol limit of 7, this study was modified to use the
    following index symbols as the default.  Up to 7 symbols may be entered
    through Edit Studies.

    Formula Parameters:                 Default:
    Momentum Length                     20
    Symbol 1                            $BANK   - Nasdaq Banking
    Symbol 2                            $NBI    - Nasdaq Biotech
    Symbol 3                            $IXCO   - Nasdaq Computer
    Symbol 4                            $IXF    - Nasdaq Financial
    Symbol 5                            $IXTC   - Nasdaq Telecommunications
    Symbol 6                            NA
    Symbol 7                            NA
    *****************************************************************/


    function preMain() {
        
    setStudyTitle("Advance Issues Momentum ");
        
    setShowTitleParameters(false);
        
    setCursorLabelName("AIM"0);
        
    setDefaultBarFgColor(Color.black0);
        
    setDefaultBarThickness(20);
        
        var 
    fp0 = new FunctionParameter("nMomLen"FunctionParameter.NUMBER);
        
    fp0.setName("Momentum Length");
        
    fp0.setLowerLimit(1);
        
    fp0.setDefault(20);
        
        var 
    fp1 = new FunctionParameter("sSym1"FunctionParameter.STRING);
        
    fp1.setName("Symbol 1");
        
    fp1.setDefault("$BANK");

        var 
    fp2 = new FunctionParameter("sSym2"FunctionParameter.STRING);
        
    fp2.setName("Symbol 2");
        
    fp2.setDefault("$NBI");

        var 
    fp3 = new FunctionParameter("sSym3"FunctionParameter.STRING);
        
    fp3.setName("Symbol 3");
        
    fp3.setDefault("$IXCO");

        var 
    fp4 = new FunctionParameter("sSym4"FunctionParameter.STRING);
        
    fp4.setName("Symbol 4");
        
    fp4.setDefault("$IXF");

        var 
    fp5 = new FunctionParameter("sSym5"FunctionParameter.STRING);
        
    fp5.setName("Symbol 5");
        
    fp5.setDefault("$IXTC");

        var 
    fp6 = new FunctionParameter("sSym6"FunctionParameter.STRING);
        
    fp6.setName("Symbol 6");
        
    fp6.setDefault("");

        var 
    fp7 = new FunctionParameter("sSym7"FunctionParameter.STRING);
        
    fp7.setName("Symbol 7");
        
    fp7.setDefault("");
    }


    var 
    bEdit true;
    var 
    aSym = new Array(8);
    var 
    aPrice0 = new Array(8);
    var 
    aPriceN = new Array(8);
    var 
    aAIM = new Array(4);
    var 
    vAIM 0;
    var 
    nCount 0;
    var 
    vColor null;

    function 
    main(nMomLensSym1sSym2sSym3sSym4sSym5sSym6sSym7) {
        var 
    nState getBarState();
        var 
    nIndex getCurrentBarIndex();
        var 
    i;    
        
        if (
    bEdit == true) {
            
    aSym[0] = getSymbol();
            for (
    18; ++i) {
                
    aSym[i] = eval("sSym"+i);
                if (
    aSym[i] != null && aSym[i] != ""nCount++
            }
            
    setStudyMax(nCount +1);
            
    setStudyMin(-1);
            
    bEdit false;
        }
        
        if (
    nState == BARSTATE_NEWBAR) {
            
    aAIM.pop();
            
    aAIM.unshift(vAIM);
            for (
    18; ++i) {
                if (
    aSym[i] != null && aSym[i] != "") {
                    
    aPriceN[i] = close(-nMomLenaSym[i]);
                }
            }
        }
        
        for (
    18; ++i) {
            if (
    aSym[i] != null && aSym[i] != "") {
                
    aPrice0[i] = close(0aSym[i]);
            }
        }
        
        
    // n-days momentum
        
    vAIM 0;
        for (
    18; ++i) {
            if (
    aPriceN[i] != null && aPrice0[i] != null) {
                if ( (
    aPrice0[i] - aPriceN[i]) > vAIM++;
            }
        }
        
    aAIM[0] = vAIM;
        
        
    // Back Testing code
        
    var bBT false;
        var 
    bLong false;
        var 
    bShort false;
        if (
    nIndex && aAIM[3] != null) { // allow back testing
            
    bBT true;
        }

        
    // Trading Signals
        
    if (aAIM[3] != null) {
            if (
    aAIM[3] >= aAIM[2] && aAIM[2] >= aAIM[1] && aAIM[1] < aAIM[0]) {
                if (
    aAIM[0] <= (0.5 nCount) ) {
                    
    bLong true;
                    
    vColor Color.green;
                }
            } else if (
    aAIM[3] <= aAIM[2] && aAIM[2] <= aAIM[1] && aAIM[1] > aAIM[0]) {
                if (
    aAIM[0] >= (0.5 nCount) ) {
                    
    bShort true;
                    
    vColor Color.red;
                }
            }
        }
        
        
    // Back Testing Code
        
    if (bBT == true) {
            if (
    Strategy.isLong() == false && bLong == true) { // long entry
                
    Strategy.doLong("Buy"Strategy.MARKETStrategy.NEXTBAR);
            } else if (
    Strategy.isShort() == false && bShort == true) { // short entry
                
    Strategy.doShort("Short"Strategy.MARKETStrategy.NEXTBAR);
            }
        }
        
        if (
    vColor != nullsetBarBgColor(vColor);
        return 
    vAIM;

    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