mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-04 04:07:42 +00:00
24e86d762a
- 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.
44 lines
1.8 KiB
Plaintext
44 lines
1.8 KiB
Plaintext
// The MIT License (MIT)
|
|
// © mihakralj
|
|
//@version=6
|
|
indicator("Aroon Oscillator", "AROONOSC", overlay=false)
|
|
|
|
//@function Calculates Aroon Oscillator (Aroon Up - Aroon Down)
|
|
//@param period Number of bars used in the calculation
|
|
//@returns Aroon Oscillator value ranging from -100 to +100
|
|
aroonosc(simple int period) =>
|
|
if period <= 0
|
|
runtime.error("Period must be greater than 0")
|
|
|
|
float highest_pos = ta.highestbars(high, period)
|
|
float lowest_pos = ta.lowestbars(low, period)
|
|
|
|
float aroon_up = 100 * (period + highest_pos) / period
|
|
float aroon_down = 100 * (period + lowest_pos) / period
|
|
|
|
float oscillator = aroon_up - aroon_down
|
|
oscillator
|
|
|
|
// ---------- Main loop ----------
|
|
|
|
// Inputs
|
|
i_period = input.int(25, "Period", minval=1, tooltip="Number of bars used in the calculation")
|
|
|
|
// Calculation
|
|
oscillator = aroonosc(i_period)
|
|
|
|
// Plot
|
|
plot(oscillator, "Aroon Oscillator", color=color.yellow, linewidth=2)
|
|
hline(0, "Zero Line", color=color.gray, linestyle=hline.style_solid)
|
|
hline(50, "Upper Level", color=color.gray, linestyle=hline.style_dashed)
|
|
hline(-50, "Lower Level", color=color.gray, linestyle=hline.style_dashed)
|
|
|
|
// Color fill for positive/negative regions
|
|
bgcolor(oscillator > 0 ? color.new(color.green, 90) : color.new(color.red, 90), title="Background")
|
|
|
|
// Alert conditions
|
|
alertcondition(ta.crossover(oscillator, 0), "Bullish Crossover", "Aroon Oscillator crossed above zero on {{ticker}}")
|
|
alertcondition(ta.crossunder(oscillator, 0), "Bearish Crossover", "Aroon Oscillator crossed below zero on {{ticker}}")
|
|
alertcondition(oscillator > 70, "Strong Uptrend", "Strong uptrend detected on {{ticker}} (Oscillator > 70)")
|
|
alertcondition(oscillator < -70, "Strong Downtrend", "Strong downtrend detected on {{ticker}} (Oscillator < -70)")
|