Edgoro
Trend indicator

Aroon indicator: Aroon Up, Aroon Down and Pine Script v6 code

How Aroon Up and Aroon Down time the latest high and low, how traders read crosses and 70/30 readings to spot trends, settings, and a free Aroon script.

What it measures

The Aroon indicator measures how recently the highest high and the lowest low of the last N bars happened. If the market keeps making new highs, Aroon Up stays near 100; if the last new high was long ago, it drops towards 0. Aroon Down does the same for lows.

It's a trend indicator built on time rather than price distance. Tushar Chande introduced it in 1995; the name comes from a Sanskrit word for the first light of dawn, a reference to spotting the start of a trend.

The formula in words

  1. Look at the last N + 1 bars (N = 25 in Chande's original, 14 on many platforms).
  2. Aroon Up = 100 × (N − bars since the highest high) ÷ N.
  3. Aroon Down = 100 × (N − bars since the lowest low) ÷ N.
  4. Aroon oscillator = Aroon Up − Aroon Down, from −100 to +100.

A new high on the current bar gives Aroon Up = 100. Each bar without a new high subtracts 100 ÷ N, so with N = 14 the line steps down by about 7 points a bar. In Pine Script, ta.highestbars() returns how many bars ago the highest high was (as a negative number), which is all the formula needs.

How traders read it

  • Strong trend. Aroon Up above 70 with Aroon Down below 30 means recent new highs and no recent new lows: an uptrend reading. The reverse is a downtrend reading. The script shades those periods.
  • Crosses. Aroon Up crossing above Aroon Down says the most recent extreme is now a high rather than a low. It's an early and noisy signal.
  • Both low. Aroon Up and Aroon Down both below 50 means neither a recent high nor a recent low: consolidation. Some traders watch for this before a breakout.
  • Step pattern. Because Aroon falls in fixed steps between new extremes, the reading tells you exactly how many bars ago the last high or low was.

Common settings

SettingTypical valueNotes
Length14 or 2525 is Chande's original; longer lengths describe longer trends.
Strong level70Some use 80 for stronger readings.
Weak level30The mirror of the strong level.

Pine Script v6 code

The complete, self-contained script is below. Copy it into a new indicator in TradingView's Pine Editor, or download the .pine file.

Pine Script v6
//@version=6
indicator("Aroon", shorttitle = "Aroon", format = format.price, precision = 2)

len    = input.int(14, "Length", minval = 1, group = "Calculation")
strong = input.int(70, "Strong level", minval = 50, maxval = 100, group = "Levels")
weak   = input.int(30, "Weak level", minval = 0, maxval = 50, group = "Levels")

// ta.highestbars() returns how many bars ago the highest high was, as a negative number (0 = this bar).
aroonUp   = 100.0 * (ta.highestbars(high, len + 1) + len) / len
aroonDown = 100.0 * (ta.lowestbars(low, len + 1) + len) / len
osc       = aroonUp - aroonDown

crossUp   = ta.crossover(aroonUp, aroonDown)
crossDown = ta.crossunder(aroonUp, aroonDown)
strongUp   = aroonUp >= strong and aroonDown <= weak
strongDown = aroonDown >= strong and aroonUp <= weak
strongUpStarts   = strongUp and not strongUp[1]
strongDownStarts = strongDown and not strongDown[1]

plot(aroonUp, "Aroon Up", color = color.new(color.teal, 0), linewidth = 2)
plot(aroonDown, "Aroon Down", color = color.new(color.red, 0), linewidth = 2)
plot(osc, "Aroon oscillator", display = display.data_window)
hline(strong, "Strong", color = color.gray, linestyle = hline.style_dashed)
hline(50, "Midline", color = color.new(color.gray, 60), linestyle = hline.style_dotted)
hline(weak, "Weak", color = color.gray, linestyle = hline.style_dashed)
bgcolor(strongUp ? color.new(color.teal, 92) : strongDown ? color.new(color.red, 92) : na, title = "Strong trend background")

alertcondition(crossUp, "Aroon Up crosses above Down", "Aroon Up crossed above Aroon Down on {{ticker}} ({{interval}})")
alertcondition(crossDown, "Aroon Down crosses above Up", "Aroon Down crossed above Aroon Up on {{ticker}} ({{interval}})")
alertcondition(strongUpStarts, "Strong uptrend reading", "Aroon Up is above the strong level and Aroon Down below the weak level on {{ticker}} ({{interval}})")
alertcondition(strongDownStarts, "Strong downtrend reading", "Aroon Down is above the strong level and Aroon Up below the weak level on {{ticker}} ({{interval}})")

Aroon Up and Aroon Down are plotted in their own pane with the 70/30 levels; the background turns green or red while a strong-trend reading is active, and the oscillator value is in the data window.

Alert conditions cover both crosses and the start of each strong-trend reading. The values come from highs and lows, which can still change on the live bar, so use Once per bar close.

Add it to your chart

  1. Open any chart on TradingView and open the Pine Editor.
  2. Create a new indicator, delete the template code and paste the script.
  3. Click Save, then Add to chart. Change lengths and levels from the indicator's settings.

Stuck on an error? See how to add a Pine Script indicator to TradingView.

Pitfalls

  • Lag by design. Aroon reacts to new extremes, so in a fresh trend it rises only as the new highs arrive. It confirms trends rather than anticipating them.
  • Crosses in ranges. In sideways markets new highs and lows alternate and the lines cross often.
  • Ignoring distance. Aroon counts bars, not price. A new high by one tick counts the same as a breakout by a wide margin.
  • Length and timeframe. 25 bars is about a month of daily bars and two hours of 5-minute bars; the meaning of "recent" changes with it.

The script is an educational example: test it on your own markets before relying on it. Indicators describe the past; they don't predict the future. Trading involves substantial risk of loss and is not suitable for every investor. Edgoro is a software tool, not a broker or financial adviser: nothing it produces is investment advice, and past or backtested performance does not guarantee future results.

Make it yours with Edgoro

Describe the change in plain English and Edgoro writes the Pine Script v6 for you, ready to paste. For example:

“Plot Aroon(25), shade strong trend readings above 70 and below 30, and alert when Aroon Up crosses above Aroon Down while the close is above the 50 EMA.”

Build your Aroon indicator