The Aroon Indicator is a technical analysis tool that identifies the strength and direction of a trend. It consists of two components: Aroon Up and Aroon Down, which measure the time since the highest high and the lowest low, respectively, over a specified period. It is used to determine whether a security is in a trend and how strong the trend is.
const period = 14; // Lookback period for the Aroon calculation
const aroon = new I.Aroon([period]);
period
(Integer):
period
of 14 calculates the Aroon values based on the last 14 data points.The Aroon
object provides two series of values:
Both values range between 0 and 100. High values (close to 100) indicate a strong trend, while low values indicate a weak or no trend.
To access the current values of the Aroon indicator:
const iv = HFS.indicatorValues(state);
const {up, down} = iv.aroon// Retrieve the most recent Aroon Down value
const period = 14; // Calculate Aroon over 14 periods
const aroon = new I.Aroon([period]);
const iv = HFS.indicatorValues(state);
const {up, down} = iv.aroon
console.log(`Aroon Up: ${aroonUp}, Aroon Down: ${aroonDown}`);
Use Aroon to detect trends:
if (aroonUp > 70 && aroonDown < 30) {
console.log("Strong uptrend detected.");
} else if (aroonDown > 70 && aroonUp < 30) {
console.log("Strong downtrend detected.");
} else {
console.log("Sideways or weak trend.");
}