Overview

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.

Syntax

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]);

Parameters

  1. smoothing (Integer):
  2. length (Integer):

Returns

The ADX object provides a single value that represents the trend strength. The value ranges between 0 and 100:

Accessing Indicator Values

To access the ADX value:

const iv = HFS.indicatorValues(state);
const adxValue = iv.adx; // Retrieve the most recent ADX value

Example Usage

Basic Implementation

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

Trend Strength Analysis

Use ADX to evaluate trend strength: