Announcement

Collapse
No announcement yet.

Advance-Decline Indicator

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

  • Advance-Decline Indicator

    File Name: AdvDecAvg.efs

    Description:
    Advance-Decline Indicator

    Formula Parameters:
    Length : 10
    BuyBand : -1500
    SellBand : 1500
    Symbol : $ADD


    Notes:
    The Advance-Decline Indicator is a market breadth indicator
    based on the smoothed difference between advancing and declining issues.
    The indicator shows when the stock market is overbought (and a correction
    is due) and when it is oversold (and a rally is due).
    The Advance-Decline Indicator is a 10-period exponential moving average of
    the difference between the number of advancing and declining issues:



    Download File:
    AdvDecAvg.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:        
        Advance-Decline Indicator  
        
    Version:            1.0  04/22/2009
        
    Formula Parameters:                     Default:
        Length                              10
        BuyBand                             -1500
        SellBand                            1500
        Symbol                              $ADD
        
    Notes:
        The Advance-Decline Indicator is a market breadth indicator 
        based on the smoothed difference between advancing and declining issues.
        The indicator shows when the stock market is overbought (and a correction 
        is due) and when it is oversold (and a rally is due).
        The Advance-Decline Indicator is a 10-period exponential moving average of 
        the difference between the number of advancing and declining issues:

    **********************************/
    var fpArray = new Array();
    var 
    bInit false;

    function 
    preMain() {
        
    setStudyTitle("Advance-Decline Indicator");
        
    setCursorLabelName("Advance-Decline"0);
        
    setDefaultBarFgColor(Color.red0);    
        
    setPriceStudy(false);
        
    setStudyMax(2000);
        
    setStudyMin(-2000);
        var 
    0;
        
    fpArray[x] = new FunctionParameter("Length"FunctionParameter.NUMBER);
        
    with(fpArray[x++]) {
            
    setLowerLimit(1);
            
    setDefault(10);
        }
        
    fpArray[x] = new FunctionParameter("BuyBand"FunctionParameter.NUMBER);
        
    with(fpArray[x++]) {
            
    setLowerLimit(-2000);
            
    setDefault(-1500);
        }
        
    fpArray[x] = new FunctionParameter("SellBand"FunctionParameter.NUMBER);
        
    with(fpArray[x++]) {
            
    setLowerLimit(-2000);
            
    setDefault(1500);
        }
        
    fpArray[x] = new FunctionParameter("Symbol"FunctionParameter.STRING);
        
    with(fpArray[x++]) {
            
    addOption("$ADDQ");
            
    addOption("$ADD");
            
    setDefault("$ADD");
        }   
    }

    var 
    xOvbOvs null;

    function 
    main(LengthSymbolBuyBandSellBand) {
    var 
    nBarState getBarState();
    var 
    nOvbOvs 0;
        if (
    nBarState == BARSTATE_ALLBARS) {
            if (
    Length == nullLength 10;
            if (
    BuyBand == nullBuyBand = -1500;
            if (
    SellBand == nullSellBand 1500;        
            if (
    Symbol == nullSymbol "$ADD";
        }
        if (
    bInit == false) {
            
    addBand(BuyBandPS_SOLID1Color.blue"Buy");
            
    addBand(SellBandPS_SOLID1Color.blue"Sell");        
            
    xOvbOvs ema(Lengthsym(Symbol));
            
    bInit true;
        }
        
    nOvbOvs xOvbOvs.getValue(0);
        if (
    nOvbOvs == null) return;
        if (
    nOvbOvs SellBand) {
            
    setBarBgColor(Color.green);
        }
        if (
    nOvbOvs BuyBand) {
            
    setBarBgColor(Color.red);
        }
        
        return 
    nOvbOvs;

Working...
X