Xu hướng TrendMT5 Built-inWilder Có trong Builder

ADX Wilder

MetaTrader 5 ships two ADXs. iADXWilder uses Wilder's own smoothing and divides after smoothing; iADX uses an EMA and divides before it. At the same period of 14 the two lines differ by about 10 points, and the familiar 'ADX above 25' filter fires roughly twice as often on one as on the other.

Default
14
Trend threshold
25 (convention)
vs iADX at 14
≈ 10 points apart
Bars where ADX Wilder is above 2525 — the same threshold, crossed twice as often by iADXADX Wilder(14) against iADX(14) — same period, different smoothing

Minh họa — dữ liệu tổng hợp, không phải giá thực.

What ADX Wilder tells you

ADX Wilder measures how much of a market's movement is going one way, without saying which way. It compares how far today's high exceeded yesterday's against how far today's low fell below yesterday's, smooths both, expresses them as a share of the average true range, and then measures the gap between them. A large gap means one side is doing most of the work; a small gap means the market is going nowhere in particular. The important thing on this page is not that definition — the ADX page has the same one — but that MetaTrader implements it twice. iADXWilder smooths the way Wilder did, with 1/N, and divides by ATR after smoothing. iADX smooths with an EMA at 2/(N+1) and divides each bar by its own true range before smoothing. Measured on three synthetic series at the same period of 14, the two main lines differ by 9.7 to 10.2 points on average, and iADX reads higher essentially all the time.

  • A built-in, but not the built-in — iADX is a different function with different output
  • It reads about 10 points lower than iADX at the same period
  • So a fixed threshold like 25 is not portable between the two
  1. 1 Directional movement: +DM and −DM from today's high and low against yesterday's
  2. 2 Smooth both, and true range, with Wilder's 1/N — then divide to get +DI and −DI
  3. 3 Smooth the normalised gap between them; that is ADX
Hiển thị công thức & chi tiết tính toán

MetaTrader 5 ships this indicator twice, so the calculation below is worth reading against the one on the ADX page. Both sources are bundled with the terminal, under Indicators/Examples.

The directional movement is chosen identically in both:

up = high[i] - high[i-1],   dn = low[i-1] - low[i]
clip both at zero; keep only the larger; if equal, both become zero
tr = max(|high-low|, |high-prevClose|, |low-prevClose|)

From here they part. ADXW.mq5 (this page) smooths first and divides afterwards:

atr = SmoothedMA(tr),  pds = SmoothedMA(+DM),  nds = SmoothedMA(-DM)
+DI = 100 * pds / atr
-DI = 100 * nds / atr
DX  = 100 * |+DI - -DI| / (+DI + -DI)
ADX = SmoothedMA(DX)

SmoothedMA(price, prev, N) = (prev*(N-1) + price) / N      <- weight 1/N

ADX.mq5 divides each bar first and smooths the percentages:

pd = 100 * (+DM) / tr,   nd = 100 * (-DM) / tr             <- per bar, before smoothing
+DI = ExponentialMA(pd),  -DI = ExponentialMA(nd)
ADX = ExponentialMA(DX)

ExponentialMA(price, prev, N) = price*2/(N+1) + prev*(1 - 2/(N+1))   <- weight 2/(N+1)

At period 14 the weights are 1/14 = 0.0714 and 2/15 = 0.1333. Measured over 2,700 bars on each of three synthetic series, the two main lines are 9.93, 10.19 and 9.66 points apart on average, with iADX higher throughout (34.67, 34.51, 37.20 against 26.74, 26.24, 31.20).

Splitting the causes apart by swapping one factor at a time:

smoothing only (same order):     9.96 / 10.30 /  9.36 points
order only (same smoothing):     3.96 /  4.07 /  4.38 points
both (the real difference):      9.93 / 10.19 /  9.66 points

So the smoothing constant is about two and a half times the larger effect, and the order is not negligible. Solving 2/(N+1) = 1/14 predicts that iADX at 27 should match this at 14 — but sweeping the period, the closest was 26 (mean difference 3.90, against 3.96 at 27), and the difference bottoms out around 3.9 rather than at zero. That floor is the normalisation order; no period removes it.

The consequence lands on the threshold rather than on the line. Counting upward crossings of 25 over the same window:

              iADX(14)   ADXW(14)   paired, mean lag   iADX-only
walk-low        497        250        13.5 bars          276
walk-high       458        258        12.6 bars          248
trending        385        213        12.5 bars          210

Wilder’s smoothing is also slower to forget where it started. Recomputing from a truncated history and comparing the final value with a full-history baseline: 50 bars was off by 5.53 points, 100 by 0.35, 200 by 0.0003, and 300 matched exactly — while iADX was inside 0.0002 by 100 bars.

This page exists because two functions share a name and not a formula. It is not the only place that happens: the Detrended Price Oscillator that ships with MetaTrader shortens its moving average instead of shifting the price, where the textbook does the opposite. Measured, those two correlate at −0.44 — worse than a disagreement about smoothing, since the current price moves them in opposite directions. In both cases the name on the indicator does not tell you which formula is running.

Tín hiệu

Các tín hiệu có thể backtest của ADXW — và điều kiện thị trường phù hợp với từng tín hiệu.

DI Cross

Sẵn sàng trong Builder
Điều kiện
+DI crosses above −DI (mirrored for shorts)
Điều kiện tốt nhất
Trending
Sử dụng thông thường
The entry in Wilder's original system, and the template's

Strength Gate

Sẵn sàng trong Builder
Điều kiện
The main line is above 25 while another rule wants to trade
Điều kiện tốt nhất
Trending
Sử dụng thông thường
The most common use — one node and one Compare, no entry of its own

DI Cross with a Strength Gate

Sẵn sàng trong Builder
Điều kiện
A DI cross while the main line is above 25
Điều kiện tốt nhất
Trending
Sử dụng thông thường
The template as shipped. Measured, the gate is doing real work: the same 25 removes far more crossings here than it does on iADX

Rising ADX with a falling price

Diễn giải thủ công
Điều kiện
The main line climbs while price falls — strength without direction
Điều kiện tốt nhất
Either regime
Sử dụng thông thường
A reminder that this line carries no sign; the DI pair is what says which way

Triển khai trong MT5

Những gì MetaTrader 5 thực sự tính và vẽ — cơ sở tham chiếu cho mọi quy tắc trên trang này.

Bộ đệm

Chỉ số Bộ đệm MT5 vẽ dưới dạng Chứa gì
0 MAIN_LINE Line ADX itself — how strongly price is moving in one direction, 0–100, with no sign. It is the smoothed DX, and the smoothing here is Wilder's: each new bar contributes 1/N. That is roughly half the weight iADX gives it, which is why this line is slower and, measured on synthetic series, sits about 10 points lower on average.
1 PLUSDI_LINE Line +DI — smoothed upward directional movement as a percentage of smoothed true range. Note the order: the smoothing happens first and the division by ATR second. iADX divides each bar by that bar's true range before smoothing, which is why its +DI is a different series rather than the same one shifted.
2 MINUSDI_LINE Line −DI — the mirror of +DI for downward movement. The cross of +DI and −DI is the entry in Wilder's original system, and it is what this page's template trades.

Ghi chú nền tảng

Hoạt động tốt nhất / sử dụng cẩn thận

Không có chỉ báo nào có lợi thế toàn diện. Đây là nơi ADXW hỗ trợ — và nơi nó gây hiểu lầm.

Hoạt động tốt nhất

  • As a gate on a rule that already has a direction
  • Higher timeframes, where 1/N smoothing is not too slow to be usable
  • Strategies ported from Wilder's own writing, where 1/N is what was meant
  • Thresholds you have measured on this line rather than borrowed from iADX

Sử dụng cẩn thận

  • Reusing a 25 threshold tuned on iADX — measured, that fires about twice as often
  • Assuming the period means the same thing in both; 1/14 and 2/15 are not the same weight
  • Trading the DI cross bare, without the strength gate
  • Comparing charts across platforms without checking which ADX is drawn

Xây dựng chiến lược ADXW

Kết nối tín hiệu vào quy tắc vào lệnh và thoát lệnh, sau đó xuất EA MT5 có thể biên dịch — không cần code.

  1. Three ADX Wilder nodes at 14 — +DI, −DI and the main line, all on the last closed bar
  2. +DI crossed against −DI, once upward and once downward
  3. The main line compared against 25, feeding both sides
  4. Cross up and above 25 → Close short, then Open Buy · SL 60 / TP 180
  5. Cross down and above 25 → Close long, then Open Sell, mirrored

Kết hợp ADXW với các chỉ báo khác

Một chỉ báo hiếm khi đứng một mình. Các cặp kết hợp này bù đắp điểm mù của ADXW.

ADXW + ADX

  1. ADX Wilder main line
  2. Compare against 25
Lý do
Not a pairing so much as a warning, and the reason this page exists. The two are separate MQL5 functions with separate handles, and reading both pages together is the only way to see which one a strategy actually meant. Measured on three synthetic series at period 14, the main lines differ by 9.7 to 10.2 points on average, iADX reads higher (34.5–37.2 against 26.2–31.2), and the 25 line is crossed 497 times against 250. If a rule was written against one and run against the other, the trade count changes by about a factor of two before anything else is touched
Điều kiện tốt nhất
Either regime

No template holds both, and there is rarely a reason to. Pick the one your threshold was measured on.

Mở Builder →

ADXW + ATR

  1. ADX Wilder above 25
  2. ATR
  3. And gate
Lý do
ATR is already inside this indicator — the DI pair is directional movement divided by smoothed true range — so putting it beside the line is a way of separating the two questions it answers. A high main line with a small ATR is a quiet, orderly drift; the same reading with a large ATR is a fast market. One caveat on the pairing: the true range inside this indicator is smoothed Wilder's way, 1/N, while the ATR node calls iATR, which the bundled ATR.mq5 computes as a rolling simple average. Their averages agree but their timing does not — measured, iATR reaches 90% of a tripled volatility level in 19 bars against Wilder's 59 — so the two are not on the same clock at the same period
Điều kiện tốt nhất
Trending

Add an ATR node beside the ADX Wilder nodes and gate the entry on both.

Mở Builder →

ADXW + Parabolic SAR

  1. ADX Wilder above 25
  2. Parabolic SAR flip
  3. And gate
Lý do
Wilder published both in the same 1978 book, and they were designed to be used together: the directional system says whether a trend is worth trading, and SAR says where to stop out of it. Because this node uses Wilder's smoothing rather than the EMA variant, the pair behaves the way the original description implies. The main line gates entries; SAR trails the exit
Điều kiện tốt nhất
Trending

Add a Parabolic SAR node and compare it against price, gated by the ADX Wilder main line.

Mở Builder →

Tham số

Giá trị ban đầu để xác nhận trên cặp tiền và khung thời gian của bạn — không phải cài đặt được đảm bảo.

Tham số Mặc định Khoảng thử nghiệm đề xuất Chức năng
Period 14 1–999 The Wilder smoothing length, used for true range, for both directional movements and for the final DX smoothing. Here it means a weight of 1/14 per bar. On iADX the same number means 2/15, so the two are not interchangeable: measured, the iADX period that comes closest to this one is 26, not 14 — and even there about 3.9 points of difference remain, because the smoothing constant is only half of what separates them.
Line Main Main / +DI / −DI Which of the three buffers this node publishes. Main is the strength with no sign, +DI and −DI are the two sides whose cross is the entry. One node emits one line, so the template uses three of them; they share a handle in the terminal, so the cost is not three indicators.
Shift 1 0–100 Which bar the node reports. The template uses 1 so decisions are made on a closed bar. With shift 0 the DI cross can appear and disappear within the same bar, which is the usual way a backtest and a live account stop agreeing.
Timeframe Current Current / M1–MN1 Which series the handle is created on. Wilder's smoothing is slow — measured, it needs about 200 bars before the value stops depending on where the calculation started, against roughly 100 for iADX — so on a low timeframe the first part of any session is warm-up rather than signal.

Cài đặt sẵn ban đầu

Template 14, with the 25 gate Wilder's own defaults and the threshold that became conventional
Gate only Main line compared against 25 One node and one Compare — nothing to fit, and the most common honest use
Matched to iADX iADX at 26 ≈ ADX Wilder at 14 Measured as the closest match; 3.9 points of difference still remain

Ví dụ thị trường

Nơi ADXW hoạt động, nơi nó thất bại, và bộ lọc thay đổi kết quả như thế nào.

Thành công

The DI cross inside a strong trend

+DI crosses above −DI while the main line is already above 25 and rising. The strength gate is doing its job here: the same cross earlier in the range would have been refused.

Thất bại

The DI cross while the market goes nowhere

The two DI lines cross repeatedly around each other with the main line under 25. This is the case the gate exists for, and it is also where the choice of ADX matters most — the iADX line would already be above the threshold here.

Đã lọc

The crossing that only the other ADX would have taken

The main line approaches 25 without reaching it, while iADX at the same period is comfortably above. Measured, about half of the iADX crossings of 25 have no counterpart on this line at all.

FAQ

Is ADX Wilder a built-in MetaTrader 5 indicator?
Yes — iADXWilder, alongside iADX. Both are built in, both return a handle to three buffers (main, +DI, −DI), and neither takes an applied price. The Builder's node creates one handle and reads whichever buffer you select.
What is the difference between ADX and ADX Wilder?
Two things, both visible in the bundled sources. The smoothing: this one uses Wilder's 1/N, iADX uses an EMA at 2/(N+1). And the order of operations: this one smooths true range and directional movement and then divides, iADX divides each bar first and smooths the percentages. Measured at period 14 the lines are 9.7 to 10.2 points apart, with iADX higher.
Which one should I use?
Whichever your threshold was measured on. If you are following Wilder's own description — the DMI system, the 25 level, the pairing with Parabolic SAR — this one is the faithful implementation. If you tuned a number on a chart drawn with iADX, keep using iADX. The mistake is mixing them, because the trade count roughly doubles or halves without any error appearing.
Can I just change the period to make them match?
Not exactly. Solving 2/(N+1) = 1/14 suggests iADX at 27, and measurement puts the closest match at 26 — but about 3.9 points of difference remain at the best setting. The smoothing constant accounts for roughly 10 points of the gap and the normalisation order for about 4, and no period can absorb the second part.
Why does it read lower than ADX?
Both effects push the same way. Dividing each bar's directional movement by that bar's true range, as iADX does, lets quiet bars contribute large percentages before any averaging happens, which lifts the DI values and with them the gap the main line measures. And the faster EMA lets those spikes through more readily. Measured averages were 34.5–37.2 for iADX against 26.2–31.2 here.
How long is the warm-up?
About 200 bars. Recomputing from a truncated history and comparing the last value with a full-history baseline: 50 bars was off by 5.53 points, 100 bars by 0.35, 200 bars by 0.0003, and 300 bars matched exactly. iADX converges roughly twice as fast because its smoothing is roughly twice as fast.
Does the DI cross happen at the same time on both?
No. +DI and −DI differ by 3.4 to 5.0 points on average between the two implementations, and although a cross is a comparison between them — so some of the difference cancels — the crossings still land on different bars. The main line's crossings of 25, which are easier to count, paired up an average of 12.5 to 13.5 bars apart.
Can I build this without coding?
Yes. The template is three ADX Wilder nodes at period 14 — one on +DI, one on −DI, one on the main line — two Cross nodes for the DI crossings, one Compare against 25 feeding both sides, two And gates, two Close nodes wired ahead of the entries, and Open Buy / Open Sell on a fixed lot. The period and the threshold are set in the Builder; the compiled EA exposes the stop distances, lot size and maximum spread as inputs.

Glossary

Thuật ngữ chính