Aroon Down

ICE Data Services -

AroonDown.efs  

EFS Library - Discussion Board  

File Name: AroonDown.efs

Description:
Aroon Down

Formula Parameters:

  • Length : 14

Notes:
This formula is one of the components of the Aroon and Aroon Oscillator indicators.
Developed by Tushar Chande in 1995, the Aroon is an indicator system that can be used to determine whether a stock is trending or not and how strong the trend is. "Aroon" means "Dawn's Early Light" in Sanskrit and Chande choose that name for this indicator since it is designed to reveal the beginning of a new trend. The Aroon indicator consists of two lines, Aroon(up) and Aroon(down). The Aroon Oscillator is a single line that is defined as the difference between Aroon(up) and Aroon(down). All three take a single parameter which is the number of time periods to use in the calculation. Since Aroon(up) and Aroon(down) both oscillate between 0 and +100, the Aroon Oscillator ranges from -100 to +100 with zero serving as the crossover line.


AroonDown indicator is calculated according to formula:
AroonDown = 100 * (Period - PeriodLow) / Period
where

PeriodLow = Number of bars since lowest low of the Period
AroonDown for a given time period is calculated by determining how much time (on a percentage basis) elapsed between the start of the time period and the point at which the lowest closing price during that time period occurred. When the stock is setting new lows for the time period, AroonDown will be 100. If the stock has moved lower every day during the time period, AroonDown will be zero.

Download File:
AroonDown.efs


EFS Code:

/*********************************
Provided By:                                                      
    Interactive Data Corporation (Copyright © eSignal) 2010.      
    All rights reserved. This sample eSignal Formula Script (EFS) 
    is for educational purposes only. Interactive Data Corporation
    reserves the right to modify and overwrite this EFS file with 
    each new release.                                             

Description:        
    AroonDown  
    
Version:            1.0  05/14/2009
    
Formula Parameters:                     Default:
    Length                              14
    
Notes:
    This formula is one of the components of the Aroon and Aroon Oscillator 
    indicators.
    Developed by Tushar Chande in 1995, the Aroon is an indicator system 
    that can be used to determine whether a stock is trending or not and 
    how strong the trend is. "Aroon" means "Dawn's Early Light" in Sanskrit 
    and Chande choose that name for this indicator since it is designed to 
    reveal the beginning of a new trend.
    The Aroon indicator consists of two lines, Aroon(up) and Aroon(down). 
    The Aroon Oscillator is a single line that is defined as the difference 
    between Aroon(up) and Aroon(down). All three take a single parameter which 
    is the number of time periods to use in the calculation. Since Aroon(up) and 
    Aroon(down) both oscillate between 0 and +100, the Aroon Oscillator ranges 
    from -100 to +100 with zero serving as the crossover line.
    AroonDown indicator is calculated according to formula:
    AroonDown = 100 * (Period - PeriodLow) / Period
    where PeriodLow = Number of bars since lowest low of the Period
    AroonDown for a given time period is calculated by determining how much time 
    (on a percentage basis) elapsed between the start of the time period and the point 
    at which the lowest closing price during that time period occurred. When the stock 
    is setting new lows for the time period, AroonDown will be 100. If the stock has 
    moved lower every day during the time period, AroonDown will be zero.
**********************************/

function preMain() {
    setStudyTitle("Aroon Down");
    setCursorLabelName("ArnDn", 0);
    setDefaultBarFgColor(Color.RGB(0xFE,0x69,0x00), 0);
    var fp1 = new FunctionParameter("nInputPeriod", FunctionParameter.NUMBER);
        fp1.setName("Length");
        fp1.setLowerLimit(1);
        fp1.setDefault(14);
}

var bInit = null;
var AryClose = null;

function main(nInputPeriod){
    var vState = getBarState();
    if (vState == BARSTATE_ALLBARS || bInit == false) {
        AryClose = new Array(nInputPeriod+1);
        bInit = true;
    }
    if (vState == BARSTATE_NEWBAR) {
	    AryClose.pop();
		AryClose.unshift(low(0));
    } else {
		AryClose[0] = low(0);
    }
    if (AryClose[AryClose.length-1] == null) return;
    var vLIndex = findLowestIndex(AryClose);
    return ((nInputPeriod-vLIndex)/nInputPeriod)*100;
}

function findLowestIndex(AryIn){    
    var vLowest = 0.0;
    var vIndex = 0;
    vLowest = AryIn[0];
    for (var i = 0; i < AryIn.length; i++){
        if (vLowest > AryIn[i]) {
            vLowest = AryIn[i];
            vIndex = i;
        }
    }
    return vIndex;
}