File Name: AroonUp.efs

Description:
Aroon Up

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.
AroonUp indicator is calculated according to formula:
AroonUp = 100 * (Period - PeriodHigh) / Period
where PeriodHigh = Number of bars since highest high of the Period
AroonUp 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 highest closing price during that time period occurred. When the stock
is setting new highs for the time period, AroonUp will be 100. If the stock has
moved higher every day during the time period, AroonUp will be zero.


Download File:
AroonUp.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:        
    AroonUp  
    
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.
    AroonUp indicator is calculated according to formula:
    AroonUp = 100 * (Period - PeriodHigh) / Period
    where PeriodHigh = Number of bars since highest high of the Period
    AroonUp 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 highest closing price during that time period occurred. When the stock 
    is setting new highs for the time period, AroonUp will be 100. If the stock has 
    moved higher every day during the time period, AroonUp will be zero.
**********************************/

function preMain() {
    
setStudyTitle("Aroon Up");
    
setCursorLabelName("ArnUp"0);
    
setDefaultBarFgColor(Color.red,1);
    var 
fp1 = new FunctionParameter("nInputPeriod"FunctionParameter.NUMBER);
        
fp1.setName("Length");
        
fp1.setLowerLimit(1);
        
fp1.setDefault(14);
}

var 
bInit null;
var 
AryClose;

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(high(0));
    } else {
        
AryClose[0] = high(0);
    }
    if (
AryClose[AryClose.length-1] == null) return;
    var 
vIndex findHighIndex(AryClose);
    return ((
nInputPeriod-vIndex)/nInputPeriod)*100;
}

function 
findHighIndex(AryIn){
    var 
vHighIndex 0;
    var 
vHigh 0.0;
    
vHigh AryIn[0];
    for(var 
1AryIn.lengthi++){
        if (
vHigh AryIn[i]) { 
            
vHigh AryIn[i];
            
vHighIndex i;
        }
    }
    return 
vHighIndex;