Skip to main content
BTC / USDT——ETH / USDT——SOL / USDT——BNB / USDT——XRP / USDT——DOGE / USDT——TON / USDT——AVAX / USDT——LINK / USDT——ADA / USDT——TRX / USDT——DOT / USDT——BTC / USDT——ETH / USDT——SOL / USDT——BNB / USDT——XRP / USDT——DOGE / USDT——TON / USDT——AVAX / USDT——LINK / USDT——ADA / USDT——TRX / USDT——DOT / USDT——
Tarifs

ADX (Average Directional Index)

Trend-strength gauge from the directional-movement lines — TradeStation and MetaStock code.

ADX measures trend strength (not direction) by smoothing the spread between the +DI and −DI directional-movement lines. Readings above about 25 mark a trending market worth following; below 20 warns of a range where trend-following systems chop. Copy the version for your platform.

MQL4 · ADX.mq4
#property indicator_separate_window
#property indicator_buffers 1

input int ADXPeriod = 14;

double ADXBuffer[];

int OnInit() {
  SetIndexBuffer(0, ADXBuffer);
  IndicatorShortName("ADX");
  return 0;
}

int OnCalculate(const int rates_total, const int prev_calculated, const double &close[]) {
  for (int i = 0; i < rates_total; i++) {
    ADXBuffer[i] = iADX(NULL, 0, ADXPeriod, PRICE_CLOSE, MODE_MAIN, i);
  }
  return rates_total;
}
MQL5 · ADX.mq5
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_plots   1

input int ADXPeriod = 14;

double ADXBuffer[];

int OnInit() {
  SetIndexBuffer(0, ADXBuffer, INDICATOR_DATA);
  IndicatorSetString(INDICATOR_SHORTNAME, "ADX");
  return INIT_SUCCEEDED;
}

int OnCalculate(const int rates_total, const int prev_calculated,
                const datetime &time[], const double &open[],
                const double &high[], const double &low[],
                const double &close[], const long &tick_volume[],
                const long &volume[], const int &spread[]) {
  for (int i = 0; i < rates_total; i++) {
    ADXBuffer[i] = iADX(_Symbol, PERIOD_CURRENT, ADXPeriod);
  }
  return rates_total;
}
Pine Script
//@version=5
indicator("ADX")
diLength = input.int(14, "DI Length")
adxSmoothing = input.int(14, "ADX Smoothing")
[diPlus, diMinus, adxValue] = ta.dmi(diLength, adxSmoothing)
plot(adxValue, "ADX", color=color.red)
EasyLanguage
inputs: Length(14);
Plot1(ADX(Length), "ADX");
MetaStock
ADX(14)

To use it inside dtcharts, paste any version into the Script Converter and it becomes a native indicator on your chart.