Files
QuanTAlib/lib/dynamics/aroon/aroon.pine
T
Miha Kralj 24e86d762a Add documentation links for various volatility indicators and channels
- Updated BBWN, BBWP, CCV, CV, CVI, EWMA, GKV, HLV, HV, Jvolty, JVOLTYN, MASSI, NATR, RSV, RV, RVI, TR, UI, VOV, VR, YZV indicators with documentation links.
- Added documentation links for Aberration, Acceleration Bands, Andrews' Pitchfork, Adaptive Price Zone, ATR Bands, Bollinger Bands, Center of Gravity, Donchian Channels, Decay Min-Max Channel, Detrended Synthetic Price, EACP, EBSW, HOMOD, Jurik Volatility Bands, Keltner Channel, MA Envelope, Min-Max Channel, Price Channel, Regression Channels, Standard Deviation Channel, Stoller Average Range Channel, Super Trend Bands, Ultimate Bands, Ultimate Channel, VWAP Bands, and VWAP with Standard Deviation Bands.
2026-02-18 11:55:48 -08:00

41 lines
1.5 KiB
Plaintext

// The MIT License (MIT)
// © mihakralj
//@version=6
indicator("Aroon (AROON)", "AROON", overlay=false)
//@function Calculates Aroon Up and Down values
//@param period Number of bars used in the calculation
//@returns tuple of Aroon Up and Aroon Down values
aroon(simple int period = 25) =>
if period <= 0
runtime.error("Period must be greater than 0")
// Find highest high and lowest low positions
float highest_pos = ta.highestbars(high, period)
float lowest_pos = ta.lowestbars(low, period)
// Calculate Aroon values
float aroon_up = 100 * (period + highest_pos) / period
float aroon_down = 100 * (period + lowest_pos) / period
[aroon_up, aroon_down]
// Inputs
i_period = input.int(25, "Period", minval=1, tooltip="Number of bars used in the calculation")
// Calculate Aroon
[aroon_up, aroon_down] = aroon(i_period)
// Plot
plot(aroon_up, "Aroon Up", color=color.yellow, linewidth=2)
plot(aroon_down, "Aroon Down", color=color.yellow, linewidth=2)
hline(50, "Mid Level", color.gray)
hline(70, "Upper Level", color.gray)
hline(30, "Lower Level", color.gray)
// Alert conditions
alertcondition(ta.crossover(aroon_up, aroon_down), "Aroon Up crosses above Down", "Bullish crossover on {{ticker}}")
alertcondition(ta.crossunder(aroon_up, aroon_down), "Aroon Down crosses above Up", "Bearish crossover on {{ticker}}")
alertcondition(aroon_up > 70 and aroon_down < 30, "Strong uptrend", "Strong uptrend detected on {{ticker}}")
alertcondition(aroon_down > 70 and aroon_up < 30, "Strong downtrend", "Strong downtrend detected on {{ticker}}")