The Average Directional Index (ADX) is a technical analysis indicator used to measure the strength of a trend, regardless of its direction. It provides a single value that quantifies the trend strength on a scale of 0 to 100, with higher values indicating stronger trends.
const smoothing = 14; // Smoothing factor for the ADX calculation
const length = 14; // Lookback period for the directional movement calculation
const adx = new I.ADX([smoothing, length]);
smoothing
(Integer):
14
.length
(Integer):
14
.The ADX
object provides a single value that represents the trend strength. The value ranges between 0 and 100:
To access the ADX value:
const iv = HFS.indicatorValues(state);
const adxValue = iv.adx; // Retrieve the most recent ADX value
const smoothing = 14;
const length = 14;
const adx = new I.ADX([smoothing, length]);
const iv = HFS.indicatorValues(state);
const adxValue = iv.adx;
console.log(`ADX: ${adxValue}`); // Outputs the most recent ADX value
Use ADX to evaluate trend strength: