What it does
Aroon Trend measures how recently price made a new high and a new low within a lookback window. Aroon Up is near 100 when the highest high was printed very recently; Aroon Down is near 100 when the lowest low was recent. The difference between them, the Aroon oscillator, gives a single trend reading from −100 to +100.
The script marks crossovers of the two lines and flags strong-trend states, when one line is high and the other is low at the same time.
How it works
For a length of n bars, the script looks at the last n + 1 bars, including the current one:
- Aroon Up = 100 × (n − bars since the highest high) ÷ n.
- Aroon Down = 100 × (n − bars since the lowest low) ÷ n.
- Aroon oscillator = Aroon Up − Aroon Down.
So if the highest high of the window is the current bar, Aroon Up is 100. If it was n bars ago, Aroon Up is 0.
Signals, all on closed bars:
- Bullish cross: Aroon Up crosses above Aroon Down. Bearish cross: the reverse.
- Strong uptrend: Aroon Up at or above the strong level (70) while Aroon Down is at or below the weak level (30). Strong downtrend mirrors this. A circle marks the first bar of each new strong state.
How to use it
- An Aroon Up line holding near 100 means price keeps printing fresh highs, the signature of a healthy uptrend. When both lines fall toward the middle, the market has stopped making new extremes and may be consolidating.
- Crossovers are early, and therefore noisy. Strong-trend states are stricter and fit trend-following ideas better.
- The oscillator is handy as a filter: above zero, the most recent high is more recent than the most recent low.
- Combine with support and resistance and a separate risk plan. H1 and above usually give cleaner readings than very low timeframes.
Settings
| Input | Default | What it changes |
|---|---|---|
| Aroon length | 14 | Window for the most recent high and low. Longer = slower. |
| Strong level | 70 | Threshold for the leading line in a strong state. |
| Weak level | 30 | Threshold for the lagging line in a strong state. |
| Show Aroon Up / Down lines | On | Toggle the two lines. |
| Show oscillator histogram | On | Toggle the oscillator columns. |
| Aroon Up / Down colors | teal / red | Line and signal colors. |
Limitations
- Aroon only cares about when the extremes happened, not how far price moved. A tiny new high counts the same as a large breakout.
- Values drop in steps as the extreme ages, and can jump when an old extreme leaves the window, which may trigger crosses with no real change in price.
- In ranges, new highs and lows alternate and the lines cross frequently.
- It is a lagging, descriptive tool; it does not forecast where price will go next.
Pine Script source
In TradingView open Pine Editor, paste the code, click Save and then Add to chart.
FXP_AroonTrend.pine
53 lines
// © FXPIPS ONLINE — https://fxpips.online/tradingview-indicators/aroon-trend/
// License: MIT. Educational tool — not financial advice. Trading involves substantial risk.
//@version=6
// Aroon Up / Aroon Down with the Aroon oscillator, line crossovers and "strong trend" states
// (one line near the top while the other is near the bottom). Signals confirm on bar close.
indicator("FXP Aroon Trend", shorttitle = "FXP Aroon", overlay = false)
// ── Inputs ─────────────────────────────────────────────────────────────
grpA = "Aroon"
len = input.int(14, "Aroon length", minval = 1, group = grpA)
strongLevel = input.float(70.0, "Strong level", minval = 50.0, maxval = 100.0, group = grpA)
weakLevel = input.float(30.0, "Weak level", minval = 0.0, maxval = 50.0, group = grpA)
grpV = "Display"
showLines = input.bool(true, "Show Aroon Up / Down lines", group = grpV)
showOsc = input.bool(true, "Show oscillator histogram", group = grpV)
colUp = input.color(#26a69a, "Aroon Up / bullish", group = grpV)
colDown = input.color(#ef5350, "Aroon Down / bearish", group = grpV)
// ── Calculation ────────────────────────────────────────────────────────
// highestbars / lowestbars return a non-positive offset to the extreme bar inside len + 1 bars.
aroonUp = 100.0 * (len + ta.highestbars(high, len + 1)) / len
aroonDown = 100.0 * (len + ta.lowestbars(low, len + 1)) / len
aroonOsc = aroonUp - aroonDown
strongUp = aroonUp >= strongLevel and aroonDown <= weakLevel
strongDown = aroonDown >= strongLevel and aroonUp <= weakLevel
crossUp = ta.crossover(aroonUp, aroonDown) and barstate.isconfirmed
crossDown = ta.crossunder(aroonUp, aroonDown) and barstate.isconfirmed
strongUpSt = strongUp and not strongUp[1] and barstate.isconfirmed
strongDnSt = strongDown and not strongDown[1] and barstate.isconfirmed
// ── Plots ──────────────────────────────────────────────────────────────
oscColor = aroonOsc >= 0 ? color.new(colUp, 70) : color.new(colDown, 70)
plot(showOsc ? aroonOsc : na, "Aroon oscillator", color = oscColor, style = plot.style_columns)
plot(showLines ? aroonUp : na, "Aroon Up", color = colUp, linewidth = 2)
plot(showLines ? aroonDown : na, "Aroon Down", color = colDown, linewidth = 2)
hline(strongLevel, "Strong level", color = color.new(color.gray, 50), linestyle = hline.style_dashed)
hline(weakLevel, "Weak level", color = color.new(color.gray, 50), linestyle = hline.style_dashed)
hline(0, "Zero", color = color.new(color.gray, 70))
plotshape(crossUp, "Aroon Up crosses above Down", style = shape.triangleup, location = location.bottom, color = colUp, size = size.small)
plotshape(crossDown, "Aroon Down crosses above Up", style = shape.triangledown, location = location.top, color = colDown, size = size.small)
plotshape(strongUpSt, "Strong uptrend start", style = shape.circle, location = location.bottom, color = colUp, size = size.tiny)
plotshape(strongDnSt, "Strong downtrend start", style = shape.circle, location = location.top, color = colDown, size = size.tiny)
// ── Alerts ─────────────────────────────────────────────────────────────
alertcondition(crossUp, "Aroon bullish cross", "Aroon Up crossed above Aroon Down on {{ticker}} ({{interval}})")
alertcondition(crossDown, "Aroon bearish cross", "Aroon Down crossed above Aroon Up on {{ticker}} ({{interval}})")
alertcondition(strongUpSt, "Aroon strong uptrend", "Aroon entered a strong uptrend state on {{ticker}} ({{interval}})")
alertcondition(strongDnSt, "Aroon strong downtrend", "Aroon entered a strong downtrend state on {{ticker}} ({{interval}})")

