More Information about:
Link: 1) www.investopedia.com/terms/a/aroon.asp
Link: 2) www.onlinetradingconcepts.com/TechnicalAnalysis/Aroon.html




Calculation:

The following formula is used to calculate Aroon indicator. It consists of two lines - Aroon(up) and Aroon(down), and the resulting Aroon Oscillator is the difference between them.

Aroon(up) = ((total_num_of_periods - num_of_periods_since_highest_close) / total_num_of_periods) x 100

Aroon(down) = ((total_num_of_periods - num_of_periods_since_lowest_close) / total_num_of_periods)) x 100

Aroon(oscillator) = Aroon(up) - Aroon(down)


Source Code "Aroon Indicator":

function init()
{

  with (Aroon) {
   createParameter("Period", 14);

   createBuffer("AroonDown");
   setBufferColor("AroonDown", 'aqua');
   setBufferDrawStyle("AroonDown", DrawStyle.LINE);

   createBuffer("AroonUp");
   setBufferColor("AroonUp", 'blue');
   setBufferDrawStyle("AroonUp", DrawStyle.LINE);

   createParameter("Level", 75);

   Aroon.max = 110
   Aroon.min = 0
   Aroon.fullName = "Aroon";
  }
}

function start()
{

 var Period = Aroon.parameter("Period");

  with (Aroon) {
   label = "Aroon Up/Down (" + Period + ")";
   removeAllLevels();
   addLevel(Aroon.parameter("Level"), "red");
  }

   var num = Shared.numberOfQuotes();
   var bufAroonUp = new Array(num);
   var bufAroonDown = new Array(num);

   var bufMax = Shared.high();
   var bufMin = Shared.low();

  for (var j = Period; j <= num; ++j) {

   var max = 0;
   var min = 0;

   var NumMax = bufMax[j - Period];
   var NumMin = bufMin[j - Period];

  for (var i = 1; i <= (Period - 1); ++i) {

   if ( bufMax[j - Period + i] >= NumMax) {
    max = i;
    NumMax = bufMax[j - Period +i];
   }

   if ( bufMin[j- Period + i] <= NumMin) {
    min = i;
    NumMin = bufMin[j - Period + i];
   }
  }

   bufAroonUp[j-1] = ((Period - (Period - 1 - max)) / Period) * 100 ;
   bufAroonDown[j-1] = ((Period - (Period - 1 - min)) / Period) * 100 ;
  }

   Aroon.setBufferData("AroonUp", bufAroonUp);
   Aroon.setBufferData("AroonDown", bufAroonDown);
}